From: Guopeng Zhang <[email protected]>

When a housekeeping check rejects a root-to-isolated or isolated-to-root
change, update_prstate() marks the partition invalid but leaves its
effective_xcpus allocated. Those CPUs remain missing from the partition
which owns the invalidated subtree.

Disable a rejected remote partition with remote_partition_disable().
For a local partition, return effective_xcpus to its parent before
recording the invalid state. Use the complete mask because descendants
are invalidated along with the parent and their CPUs return at the same
time.

Fixes: 103b08709e8a ("cgroup/cpuset: Fail if isolated and nohz_full don't leave 
any housekeeping")
Signed-off-by: Guopeng Zhang <[email protected]>
---
 kernel/cgroup/cpuset.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 853942c1afeb..a616012927be 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -3020,10 +3020,21 @@ static int update_prstate(struct cpuset *cs, int 
new_prs)
                compute_partition_owned_cpumask(cs, 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
+                       if (is_remote_partition(cs)) {
+                               WRITE_ONCE(cs->prs_err, err);
+                               remote_partition_disable(cs, &tmpmask);
+                       } else {
+                               spin_lock_irq(&callback_lock);
+                               partition_xcpus_del(old_prs, parent, 
cs->effective_xcpus);
+                               spin_unlock_irq(&callback_lock);
+                               cpuset_update_tasks_cpumask(parent, 
tmpmask.new_cpus);
+                               update_sibling_cpumasks(parent, cs, &tmpmask);
+                       }
+               } else {
                        isolcpus_updated = true;
+               }
        } else {
                /*
                 * Switching back to member is always allowed even if it
-- 
2.43.0


Reply via email to