Don't return an error on all busy CPUs - #4893
Merged
Merged
Conversation
There was a problem hiding this comment.
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.
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
Michal-Leszczynski
force-pushed
the
ml/2380-misleading-cpu-pinning-error
branch
from
July 28, 2026 11:04
17b6096 to
4e6ae8d
Compare
There was a problem hiding this comment.
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. IfTestSchedSetAffinity(or any other test) mutates affinity concurrently, this test may observe a modified affinity mask. Consider removingt.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()
Michal-Leszczynski
marked this pull request as ready for review
July 28, 2026 13:23
Michal-Leszczynski
requested review from
VAveryanov8 and
karol-kokoszka
as code owners
July 28, 2026 13:23
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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