cgroup/cpuset: Allow no-task partition to have empty cpuset.cpus.effective
authorWaiman Long <longman@redhat.com>
Thu, 1 Sep 2022 20:57:38 +0000 (16:57 -0400)
committerTejun Heo <tj@kernel.org>
Sun, 4 Sep 2022 20:47:27 +0000 (10:47 -1000)
commite2d59900d936e1c0fe091216c342cc95c4b32e97
treea4ea59c05d7a13ee037ccfe020ec07a59b6a6587
parent18065ebe9b3359b163324f3fb36f7edeb73503e2
cgroup/cpuset: Allow no-task partition to have empty cpuset.cpus.effective

Currently, a partition root cannot have empty "cpuset.cpus.effective".
As a result, a parent partition root cannot distribute out all its
CPUs to child partitions with no CPUs left. However in most cases,
there shouldn't be any tasks associated with intermediate nodes of the
default hierarchy. So the current rule is too restrictive and can waste
valuable CPU resource.

To address this issue, we are now allowing a partition to have empty
"cpuset.cpus.effective" as long as it has no task. Since cpuset is
threaded, no-internal-process rule does not apply. So it is possible
to have tasks in a partition root with child sub-partitions even though
that should be uncommon.

A parent partition with no task can now have all its CPUs distributed out
to its child partitions. The top cpuset always have some house-keeping
tasks running and so its list of effective cpu can't be empty.

Once a partition with empty "cpuset.cpus.effective" is formed, no
new task can be moved into it until "cpuset.cpus.effective" becomes
non-empty.

Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup/cpuset.c