Open
Description
Description
When CPU quota is updated with fractions, cpu.max
is updated as specified:
$ runc update container1 --cpu-quota=123456
$ cat /sys/fs/cgroup/system.slice/runc-container1.scope/cpu.max
123456 100000
However, after another parameter is updated, cpu.max
is rounded up:
$ runc update container1 --memory 100000000
$ cat /sys/fs/cgroup/system.slice/runc-container1.scope/cpu.max
124000 100000
It looks the rounded value is passed to systemd:
runc/libcontainer/cgroups/systemd/common.go
Lines 303 to 310 in 74b35d8
However, the original value seems to be written to the file:
runc/libcontainer/cgroups/systemd/v2.go
Line 492 in 74b35d8
Steps to reproduce the issue
- Create a container with systemd driver:
$ runc --systemd-cgroup run container1
- Update the CPU quota of the container with fraction:
$ runc update container1 --cpu-quota=123456
- See
cpu.max
:$ cat /sys/fs/cgroup/system.slice/runc-container1.scope/cpu.max 123456 100000
- Update another parameter of the container:
$ runc update container1 --memory 100000000
- See
cpu.max
again:$ cat /sys/fs/cgroup/system.slice/runc-container1.scope/cpu.max 124000 100000
We can see how the file is updated in the steps with tail -f
:
$ tail -f /sys/fs/cgroup/system.slice/runc-container1.scope/cpu.max
max 100000
tail: /sys/fs/cgroup/system.slice/runc-container1.scope/cpu.max: file truncated
max 100000
tail: /sys/fs/cgroup/system.slice/runc-container1.scope/cpu.max: file truncated
124000 100000
tail: /sys/fs/cgroup/system.slice/runc-container1.scope/cpu.max: file truncated
123456 100000
tail: /sys/fs/cgroup/system.slice/runc-container1.scope/cpu.max: file truncated
124000 100000
Describe the results you received and expected
The CPU quota should be configured consistently whether it is rounded up or not.
What version of runc are you using?
$ runc -v
runc version 1.2.4
commit: v1.2.4-0-g6c52b3f
spec: 1.2.0
go: go1.22.10
libseccomp: 2.5.5
Host OS information
No response
Host kernel information
No response
Metadata
Assignees
Labels
No labels
Activity