Skip to content

Don't return an error on all busy CPUs - #4893

Merged
Michal-Leszczynski merged 1 commit into
masterfrom
ml/2380-misleading-cpu-pinning-error
Aug 6, 2026
Merged

Don't return an error on all busy CPUs#4893
Michal-Leszczynski merged 1 commit into
masterfrom
ml/2380-misleading-cpu-pinning-error

Conversation

@Michal-Leszczynski

@Michal-Leszczynski Michal-Leszczynski commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

In some (small) setups, we might not have any entirely free
CPUs to pin SM agent to. The codebase already handles it in
findAndPinCPUs by not pinning to any specific CPU, but
setting runtime.GOMAXPROCS(1). So the codebase expects
that there might be no free CPUs to pin to and handles
this correctly. Not to mention, that the pinning error
is ignored in SM agent startup.

This commit removes the error returned by AvailableCPUs
when there is no free CPU. This was not visible on SM
agent startup, as the pinning error is simply ignored
there. It was visible in SM error logs when trying
to re-pin SM agent to CPUs after 1-1 or regular restore
tasks, but it didn't cause any failures.

This commit also adjusts AvailableCPUs comment, so that
it doesn't provide outdated information on AvailableCPUs
behavior.

Note that this is a change in vendored SM submodule,
so the actual fix will land on SM master only after
the module version is bumped.

Fixes https://scylladb.atlassian.net/browse/CLOUD-2380

Copilot AI review requested due to automatic review settings July 28, 2026 10:44
@github-actions github-actions Bot added the P2 label Jul 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates CPU selection to permit an empty result when all CPUs are busy.

Changes:

  • Removes the no-available-CPU error.
  • Adds coverage for the all-busy case.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
v3/pkg/util/cpuset/cpuset_linux.go Allows empty CPU results.
v3/pkg/util/cpuset/cpuset_linux_test.go Tests all CPUs being busy.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread v3/pkg/util/cpuset/cpuset_linux.go Outdated
In some (small) setups, we might not have any entirely free
CPUs to pin SM agent to. The codebase already handles it in
findAndPinCPUs by not pinning to any specific CPU, but
setting runtime.GOMAXPROCS(1). So the codebase expects
that there might be no free CPUs to pin to and handles
this correctly. Not to mention, that the pinning error
is ignored in SM agent startup.

This commit removes the error returned by AvailableCPUs
when there is no free CPU. This was not visible on SM
agent startup, as the pinning error is simply ignored
there. It was visible in SM error logs when trying
to re-pin SM agent to CPUs after 1-1 or regular restore
tasks, but it didn't cause any failures.

This commit also adjusts AvailableCPUs comment, so that
it doesn't provide outdated information on AvailableCPUs
behavior.

Note that this is a change in vendored SM submodule,
so the actual fix will land on SM master only after
the module version is bumped.

Fixes https://scylladb.atlassian.net/browse/CLOUD-2380
Copilot AI review requested due to automatic review settings July 28, 2026 11:04
@Michal-Leszczynski
Michal-Leszczynski force-pushed the ml/2380-misleading-cpu-pinning-error branch from 17b6096 to 4e6ae8d Compare July 28, 2026 11:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

v3/pkg/util/cpuset/cpuset_linux.go:1

  • Now that 'no available CPUs' is not an error, the API contract should be explicit about the empty-result case. Please update the comment to state that it may return an empty slice (and that this is not an error). Also consider returning an empty (non-nil) slice when none are available to avoid nil-vs-empty ambiguity for callers that marshal/compare slices.
// Copyright (C) 2026 ScyllaDB

v3/pkg/util/cpuset/cpuset_linux_test.go:41

  • t.Parallel() here can make the test flaky because CPU affinity is a process-wide setting. If TestSchedSetAffinity (or any other test) mutates affinity concurrently, this test may observe a modified affinity mask. Consider removing t.Parallel() for this test (mandatory), or otherwise serializing tests that read/modify affinity (e.g., a package-level mutex used by all affinity-related tests).
func TestAvailableCPUsAllBusy(t *testing.T) {
	t.Parallel()

@VAveryanov8 VAveryanov8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Michal-Leszczynski
Michal-Leszczynski merged commit 96d1de4 into master Aug 6, 2026
80 of 81 checks passed
@Michal-Leszczynski
Michal-Leszczynski deleted the ml/2380-misleading-cpu-pinning-error branch August 6, 2026 10:22
Michal-Leszczynski added a commit that referenced this pull request Aug 13, 2026
This bump includes the changes from:
- #4898
- #4893
Michal-Leszczynski added a commit that referenced this pull request Aug 13, 2026
This bump includes the changes from:
- #4898
- #4893
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants