Skip to content

update: fix --cpus writing cpuset instead of quota/period#5067

Open
kmaris wants to merge 2 commits into
containerd:mainfrom
kmaris:cpus-update-fix
Open

update: fix --cpus writing cpuset instead of quota/period#5067
kmaris wants to merge 2 commits into
containerd:mainfrom
kmaris:cpus-update-fix

Conversation

@kmaris

@kmaris kmaris commented Jul 13, 2026

Copy link
Copy Markdown

The --cpus flag was incorrectly assigning opts.CpusetCpus to the CPU Cpus (cpuset) field. Persist the converted quota and period instead, matching how --cpu-quota and --cpu-period are applied.

Closes #5066

@AkihiroSuda

Copy link
Copy Markdown
Member

Thanks, but please sign the commit for DCO
https://github.com/apps/dco

(run git commit -a -s --amend, and make sure that the Signed-off-by: NAME <EMAIL> line with your real name is included in the commit message)

@AkihiroSuda AkihiroSuda Jul 14, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The test should not be skipped on Docker?

instead of inspect --mode=native, run IMAGE cat /sys/fs/cgroup/FILE could be used?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I updated the subtests so that the cpu update will run and check the cpu.max cgroup file. Let me know if you'd like further changes, happy to help.

The --cpus flag was incorrectly assigning opts.CpusetCpus to the CPU
Cpus (cpuset) field. Persist the converted quota and period instead,
matching how --cpu-quota and --cpu-period are applied.

Closes containerd#5066

Signed-off-by: Kevin Maris <kevin@kmaris.net>
@kmaris kmaris force-pushed the cpus-update-fix branch from 4265757 to 65e169c Compare July 14, 2026 14:17
@AkihiroSuda AkihiroSuda added this to the v2.4.0 milestone Jul 14, 2026
The test-wide require.Not(nerdtest.Docker) prevented the --cpus subtest
from running. Moved the docker skipping down to the subtests that need
it so the --cpus subtest will run.

The cpus subtest also is changed to verify against the container cgroup
files but now requires cgroup v2.

Signed-off-by: Kevin Maris <kevin@kmaris.net>
@kmaris kmaris force-pushed the cpus-update-fix branch from 4eace26 to 0a94916 Compare July 14, 2026 22:04
@AkihiroSuda

Copy link
Copy Markdown
Member

Please squash the commits, then LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nerdctl update --cpus does not apply the CPU limit (writes cpuset instead of quota/period)

2 participants