Skip to content

Commit 669f940

Browse files
qdaxbkolyshkin
authored andcommitted
skip set cpu.weight when cpu.idle is enabled in cgroups v2
Signed-off-by: axb <[email protected]>
1 parent 151f480 commit 669f940

File tree

1 file changed

+2
-1
lines changed
  • libcontainer/cgroups/fs2

1 file changed

+2
-1
lines changed

libcontainer/cgroups/fs2/cpu.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ func setCpu(dirPath string, r *configs.Resources) error {
2929
}
3030

3131
// NOTE: .CpuShares is not used here. Conversion is the caller's responsibility.
32-
if r.CpuWeight != 0 {
32+
// can not set cpu.weight if cpu.idle is enabled
33+
if r.CpuWeight != 0 && (r.CPUIdle == nil || *r.CPUIdle == 0) {
3334
if err := cgroups.WriteFile(dirPath, "cpu.weight", strconv.FormatUint(r.CpuWeight, 10)); err != nil {
3435
return err
3536
}

0 commit comments

Comments
 (0)