Niceness set on Container's CGroup

I’m setting the nice value on the container config file:

lxc.cgroup2.cpu.weight.nice = 10

Although I see it set in the /sys/fs/cgroup/lxc.payload.<name> there is no nice/priority effect of it.

Is there something I’m missing?

I don’t know much about that particular file, but I generally wouldn’t expect cgroup limits to update process-specific fields.

Most likely this just sets an internal priority for the scheduler to consider and not something that’s visible from userspace.

cpu.weight.nice is documented as:

This is an alternative interface for cpu.weight and allows reading and setting weight using the same values used by nice.

The default is 0. The nice value is in the range [-20, 19]. Because the range is smaller and granularity is coarser for the nice values, the read value is the closest approximation of the current weight.
1 Like