[PATCH v3 6/7] cgroup/cpuset: Release CPUs when type-change validation fails
From: Guopeng Zhang
Date: Wed Sep 02 2026 - 06:36:10 EST
From: Guopeng Zhang <zhangguopeng@xxxxxxxxxx>
When housekeeping validation fails during a root/isolated type change,
update_prstate() marks the requested state invalid without running the
partition-disable path. The failed partition's effective_xcpus may be
cleared, but its CPUs remain unavailable 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 state is recorded as invalid, but CPU 15 remains
unavailable to the top cpuset.
Run the common partition-disable path when housekeeping validation fails.
Disable remote partitions with remote_partition_disable() and return local
partition CPUs to their parent. If that 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 <zhangguopeng@xxxxxxxxxx>
---
kernel/cgroup/cpuset.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 19efa62bb694..30d9ea5f3859 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -3042,6 +3042,7 @@ static int update_prstate(struct cpuset *cs, int new_prs)
struct cpuset *invalidated = NULL;
struct cpumask *isolcpus_update_cpus = cs->effective_xcpus;
struct tmpmasks tmpmask;
+ bool disable_partition = false;
bool isolcpus_updated = false;
if (old_prs == new_prs)
@@ -3107,6 +3108,7 @@ static int update_prstate(struct cpuset *cs, int new_prs)
!isolated_cpus_can_update(tmpmask.new_cpus, NULL)) ||
prstate_housekeeping_conflict(new_prs, tmpmask.new_cpus)) {
err = PERR_HKEEPING;
+ disable_partition = true;
} else {
/*
* Only directly owned CPUs change isolation state for a
@@ -3122,6 +3124,10 @@ static int update_prstate(struct cpuset *cs, int new_prs)
* parent would consume the last housekeeping CPU, invalidate
* the outermost isolated ancestor and return its CPUs instead.
*/
+ 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