From: Guopeng Zhang <[email protected]>
When housekeeping validation fails during a root-to-isolated or
isolated-to-root change, update_prstate() records the requested partition
type as invalid but leaves its effective_xcpus allocated. Those CPUs are
not returned to the partition which owns the invalidated subtree.
This can be reproduced on a cgroup v2 system booted with
isolcpus=domain,15:
cd /sys/fs/cgroup
echo +cpuset > cgroup.subtree_control
mkdir type-fail-repro
echo 15 > type-fail-repro/cpuset.cpus
echo isolated > type-fail-repro/cpuset.cpus.partition
echo root > type-fail-repro/cpuset.cpus.partition
cat type-fail-repro/cpuset.cpus.partition
cat cpuset.cpus.effective
The requested root type is recorded as invalid, but CPU 15 remains
unavailable to the top cpuset.
Use the common partition-disable path when housekeeping validation fails.
Disable a remote partition with remote_partition_disable(); for a local
partition, return effective_xcpus to its parent. If that return would
consume the last housekeeping CPU, invalidate the outermost isolated
ancestor instead.
Fixes: 103b08709e8a ("cgroup/cpuset: Fail if isolated and nohz_full don't leave
any housekeeping")
Fixes: b1034a690129 ("cgroup/cpuset: Ensure domain isolated CPUs stay in root
or isolated partition")
Signed-off-by: Guopeng Zhang <[email protected]>
---
kernel/cgroup/cpuset.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 32a37d624c6b..fefc0afa93ec 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2990,6 +2990,7 @@ static int update_prstate(struct cpuset *cs, int new_prs)
struct cpuset *parent = parent_cs(cs);
struct cpuset *invalidated = NULL;
struct tmpmasks tmpmask;
+ bool disable_partition = false;
bool isolcpus_updated = false;
if (old_prs == new_prs)
@@ -3052,15 +3053,21 @@ static int update_prstate(struct cpuset *cs, int
new_prs)
tmpmask.new_cpus);
if (((new_prs == PRS_ISOLATED) &&
!isolated_cpus_can_update(tmpmask.new_cpus, NULL)) ||
- prstate_housekeeping_conflict(new_prs, tmpmask.new_cpus))
+ prstate_housekeeping_conflict(new_prs, tmpmask.new_cpus)) {
err = PERR_HKEEPING;
- else
+ disable_partition = true;
+ } else {
isolcpus_updated = true;
+ }
} else {
/*
* Switching back to member is always allowed even if it
* disables child partitions.
*/
+ disable_partition = true;
+ }
+
+ if (disable_partition) {
if (old_prs == PRS_ROOT &&
parent->partition_root_state == PRS_ISOLATED &&
!isolated_cpus_can_update(cs->effective_xcpus, NULL))
--
2.43.0