[1.4] libct: fix resetting CPU affinity#5149
Merged
cyphar merged 1 commit intoopencontainers:release-1.4from Mar 5, 2026
Merged
[1.4] libct: fix resetting CPU affinity#5149cyphar merged 1 commit intoopencontainers:release-1.4from
cyphar merged 1 commit intoopencontainers:release-1.4from
Conversation
Member
|
We need #5147 to fix the CI failure. |
unix.CPUSet is limited to 1024 CPUs. Calling unix.SchedSetaffinity(pid, cpuset) removes all CPUs starting from 1024 from allowed CPUs of pid, even if cpuset is all ones. As a consequence, when runc tries to reset CPU affinity to "allow all" by default, it prevents all containers from CPUs 1024 onwards. This change uses a huge CPU mask to play safe and get all possible CPUs enabled with a single sched_setaffinity call. Fixes: opencontainers#5023 Signed-off-by: Antti Kervinen <antti.kervinen@intel.com> (cherry picked from commit 700c944) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
cyphar
approved these changes
Mar 5, 2026
AkihiroSuda
approved these changes
Mar 5, 2026
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.
Backport of #5025 to release-1.4 branch.
unix.CPUSet is limited to 1024 CPUs. Calling
unix.SchedSetaffinity(pid, cpuset) removes all CPUs starting from 1024 from allowed CPUs of pid, even if cpuset is all ones. As a consequence, when runc tries to reset CPU affinity to "allow all" by default, it prevents all containers from CPUs 1024 onwards.
This change uses a huge CPU mask to play safe and get all possible CPUs enabled with a single sched_setaffinity call.
Fixes: #5023
(cherry picked from commit 700c944)