cgroup/cpuset: Relax constraints to partition & cpus changes
authorWaiman Long <longman@redhat.com>
Thu, 1 Sep 2022 20:57:39 +0000 (16:57 -0400)
committerTejun Heo <tj@kernel.org>
Sun, 4 Sep 2022 20:47:27 +0000 (10:47 -1000)
commitf0af1bfc27b52a4d42510051154c61bd176a8f06
tree6b8ffcaa7187f457e5953c41517afb2bd22a872a
parente2d59900d936e1c0fe091216c342cc95c4b32e97
cgroup/cpuset: Relax constraints to partition & cpus changes

Currently, enabling a partition root is only allowed if all the
constraints of a valid partition are satisfied. Even changes to
"cpuset.cpus" may not be allowed in some cases. Moreover, there are
limits to changes made to a parent cpuset if it is a valid partition
root. This is contrary to the general cgroup v2 philosophy.

This patch relaxes the constraints of changing the state of "cpuset.cpus"
and "cpuset.cpus.partition". Now all valid changes ("member" or "root")
to "cpuset.cpus.partition" are allowed even if there are child cpusets
underneath it.

Trying to make a cpuset a partition root, however, will cause its state
to become invalid if the following constraints of a valid partition
root are not satisfied.

 1) The "cpuset.cpus" is non-empty and exclusive.
 2) The parent cpuset is a valid partition root.
 3) The "cpuset.cpus" overlaps parent's "cpuset.cpus".

Similarly, almost all changes to "cpuset.cpus" are allowed with the
exception that if the underlying CS_CPU_EXCLUSIVE flag is set, the
exclusivity rule will still apply.

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