-
Notifications
You must be signed in to change notification settings - Fork 2.2k
runc exec: implement CPU affinity #4327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5da8851
to
a1856a5
Compare
d94301d
to
80643c5
Compare
80643c5
to
673d846
Compare
673d846
to
57237b3
Compare
The deadline we have to publish rc1 is today and this is in the milestone but in draft. @kolyshkin what do you want to do with this? |
@rata I spoke to him earlier this week and he said that he'd like to keep it in -rc.1 if possible and that it's trivial to update this once runtime-spec 1.2.1 is released. I just released 1.2.1 of the runtime-spec so I guess he will work on this when he wakes up. Personally I think we can safely move the deadline for -rc.1 to next week. If this isn't ready by then we can do the release without it. |
@cyphar thanks! I'm fine cutting -rc.1 next week, I'm also fine cutting -rc.1 today and adding this just after -rc.1 (it's basically the same thing). But yeah, I wouldn't let rc.1 slip longer than next week. |
57237b3
to
f8c3171
Compare
This is now ready for review |
43d1b00
to
25c05be
Compare
As per - opencontainers/runtime-spec#1253 - opencontainers/runtime-spec#1261 CPU affinity can be set in two ways: 1. When creating/starting a container, in config.json's Process.ExecCPUAffinity, which is when applied to all execs. 2. When running an exec, in process.json's CPUAffinity, which applied to a given exec and overrides the value from (1). Add some basic tests. Note that older kernels (RHEL8, Ubuntu 20.04) change CPU affinity of a process to that of a container's cgroup, as soon as it is moved to that cgroup, while newer kernels (Ubuntu 24.04, Fedora 41) don't do that. Because of the above, - it's impossible to really test initial CPU affinity without adding debug logging to libcontainer/nsenter; - for older kernels, there can be a brief moment when exec's affinity is different than either initial or final affinity being set; - exec's final CPU affinity, if not specified, can be different depending on the kernel, therefore we don't test it. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Is anyone working on the rc.1 PR? I can do it, otherwise |
All tasks in 1.3.0-rc.1 are completed now, I think it's time to release |
I'm working on the PR :) |
@@ -23,6 +23,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
methods no longer ignore `Process.IOPriority` and `Process.Scheduler` | |||
settings. (#4585) | |||
|
|||
### Added | |||
* CPU affinity support for `runc exec`. (#4327) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Late to the party, but https://github.com/opencontainers/runc/blob/main/docs/spec-conformance.md had to be synced with the spec v1.2.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanna make a PR so it's included in the next rc? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change updates runc package from 1.1.12 to 1.3.0.rc2. Note that this change packages release candidate (RC) of 1.3.0 and not the final formal 1.3.0 release. A task is created to update this to the final release version in the follow-up change. Formal release is expected near the end of the month but to avoid delays in STX release, we move ahead with this release binaries as we do not expect major changes between formal release and this release. Also, note that 1.3 is preferred over latest 1.2 patch release as 1.3 contains a desirable CPU affinity feature. Ref: opencontainers/runc#4327 Test Plan: PASS: AIO-SX fresh installs with k8s versions 1.29, 1.30, 1.31 successful. System healthy. No alarms. Kubernetes cluster healthy. PASS: AIO-SX kubernetes upgrade successful from 1.29 to 1.30. Story: 2011413 Task: 51995 Change-Id: I661489342f2c3c7e562ef56bef4f03b67bda97db Signed-off-by: Kaustubh Dhokte <kaustubh.dhokte@windriver.com>
Currently a draft until runtime-spec vNext is released.As per
CPU affinity can be set in two ways:
Process.ExecCPUAffinity, which is when applied to all execs.
applied to a given exec and overrides the value from (1).
Add some basic tests.
Note that older kernels (RHEL8, Ubuntu 20.04) change CPU affinity of a
process to that of a container's cgroup, as soon as it is moved to that
cgroup, while newer kernels (Ubuntu 24.04, Fedora 41) don't do that.
Because of the above,
debug logging to libcontainer/nsenter;
is different than either initial or final affinity being set;
depending on the kernel, therefore we don't test it.
Fixes: #3922