Messages in this thread | | | Date | Wed, 23 Nov 2022 16:19:44 +0100 | From | Sebastian Andrzej Siewior <> | Subject | Re: [PATCH 2/2] cgroup/cpuset: Optimize cpuset_attach() on v2 |
| |
On 2022-11-12 17:19:39 [-0500], Waiman Long wrote: > It was found that with the default hierarchy, enabling cpuset in the > child cgroups can trigger a cpuset_attach() call in each of the child > cgroups that have tasks with no change in effective cpus and mems. If > there are many processes in those child cgroups, it will burn quite a > lot of cpu cycles iterating all the tasks without doing useful work.
Thank you.
So this preserves the CPU mask upon attaching the cpuset container.
| ~# taskset -pc $$ | pid 1564's current affinity list: 0-2
default mask after boot due to isolcpus=
| ~# echo "+cpu" >> /sys/fs/cgroup/cgroup.subtree_control ; echo "+cpuset" >> /sys/fs/cgroup/cgroup.subtree_control | ~# taskset -pc $$ | pid 1564's current affinity list: 0-2
okay.
| ~# echo 1-3 > /sys/fs/cgroup/user.slice/cpuset.cpus | ~# taskset -pc $$ | pid 1564's current affinity list: 1-3
wiped away.
| ~# taskset -pc 2-3 $$ | pid 1564's current affinity list: 1-3 | pid 1564's new affinity list: 2,3 | ~# echo 2-4 > /sys/fs/cgroup/user.slice/cpuset.cpus | ~# taskset -pc 2-3 $$ | pid 1564's current affinity list: 2,3 | pid 1564's new affinity list: 2,3
But it works if the mask was changed on purpose.
Sebastian
| |