runc icon indicating copy to clipboard operation
runc copied to clipboard

skip set cpu.weight when cpu.idle is enabled in cgroups v2

Open qdaxb opened this issue 2 years ago • 5 comments

In cgroups v2, setting cpu.weight when cpu.idle==1 will fail with Invalid argument

This pr fixed this situation, consistent with https://github.com/opencontainers/runc/blob/main/libcontainer/cgroups/systemd/v2.go#L119

qdaxb avatar Dec 12 '23 14:12 qdaxb

Instead of silently skipping we should fail as a validation error.

mrunalp avatar Dec 12 '23 23:12 mrunalp

Instead of silently skipping we should fail as a validation error.

@mrunalp Thanks for reply.

I'm still a little confused about the idle parameter.

There is no description in the spec that shares and idle cannot be applied at the same time. But If I set both shares and idle, systemd driver and fs2 driver will behave differently.

system\driver systemd/v2 fs2/cpu
support idle & systemd < 252 systemd:set cpu.weight=1
fsMgr:set cpu.idle=1 & return error
set cpu.idle=1 & return error
support idle & systemd > 252 systemd:set cpu.idle=1
fsMgr:set cpu.idle=1 & return error
set cpu.idle=1 & return error
not support idle return error return error

So I think fs2 should be compatible with this situation like systemd, or directly add a hint in the document that they cannot be used at the same time?

qdaxb avatar Dec 13 '23 03:12 qdaxb

Instead of silently skipping we should fail as a validation error.

Should be a warning to avoid breaking compatibility?

AkihiroSuda avatar Dec 15 '23 08:12 AkihiroSuda

Yes, this should probably be a warning. I'm going to carry this into #4227.

kolyshkin avatar Mar 19 '24 18:03 kolyshkin

There's no need for a warning. The problem is, Set is called during runc update with a combination of old and new settings, and thus it's normal for cpuweight and cpuidle both being set.

This PR needs a test case though. Can you add one @qdaxb ?

kolyshkin avatar May 08 '24 17:05 kolyshkin