Cpuset.cpus updated only in payload path but not in monitor path

Hello,
I am using the following call to update cpuset.cpus to “0-3” (on lxc v4.0.6)

char *name = containers[i];
c = lxc_container_new(name, LXC_PATH);
if (NULL != c) {
	if (!c->set_cgroup_item(c, "cpuset.cpus", str_max_cpuset)) {
		res = -1;
		sm_error("Failed to assign '%s' value to 'cpuset.cpus' for '%s'",str_max_cpuset, name);
	}
	lxc_container_put(c);
}

but only “cpuset.cpus” under payload path was updated the “cpuset.cpus” under monitor path was kept to 0.

#cat /sys/fs/cgroup/cpuset/lxc.payload.MyContainer1/cpuset.cpus
0-3
#cat /sys/fs/cgroup/cpuset/lxc.monitor.MyContainer1/cpuset.cpus
0

If I use:
lxc-cgroup -n MyContainer1 -P /mnt/settings/lxc cpuset.cpus “0-3”
only the payload path is changed:

#cat /sys/fs/cgroup/cpuset/lxc.payload.MyContainer1/cpuset.cpus
0-3
#cat /sys/fs/cgroup/cpuset/lxc.monitor.MyContainer1/cpuset.cpus
0

Any idea please?
Thanks

Any thoughts @amikhalitsyn ?

@Med_Fodha that’s correct behavior. lxc.payload cgroup is for the container process tree itself, but lxc.monitor is for container manager.

1 Like

Which lxc api is used to change the cpuset for the container manager? or we have to use echo "0-3" > /sys/fs/cgroup/cpuset/lxc.monitor.MyContainer1/cpuset.cpus, is there really an advantage to modify cpuset for the monitor?
At boot time both payload and monitor are set to 0-3 but after resuming from suspend we have to restore the value to “0-3”(because after resume both cpuset for payload and monitor are set to 0). I succeeded to do it for payload through lxc api but it is not the case for monitor

AFAIR there is no lxcapi for such case because it makes no sense to change cgroup limits for the monitor.

1 Like