Re: [PATCH-next 1/6] cgroup/cpuset: Find furthest isolated ancestor for invalidated isolated partition

From: Waiman Long

Date: Fri Oct 23 2026 - 13:05:27 EST


On 10/23/26 2:24 AM, Ridong Chen wrote:


On 10/22/2026 11:16 AM, Waiman Long wrote:
Commit 46b885416c27 ("cgroup/cpuset: Fix a missing isolated_cpus
update in update_cpumasks_hier()") searches for the closet partition
root ancestor to determine if the isolated CPUs in a to be invalidated
isolation partition should be removed from isolated_cpus or not.

As reported by sashiko, this method may not work when there is a deeply
nested isolated partition hierarchy. For instance, Consider a nested
hierarchy A0 -> A1 -> A2 -> A3 where all four are PRS_ISOLATED:

   A0: effective_xcpus = 0-4
   A1: effective_xcpus = 1-4
   A2: effective_xcpus = 2-4
   A3: effective_xcpus = 3-4

When A1 shrinks its exclusive_cpus from 1-4 to 1-2, A2 will update it
effective_xcpus to 2. A3 will find its closet partition root ancestor
A2 and decides that its effective_xcpus 3-4 should be removed from
isolated_cpus which is incorrect.

Address this corner case by searching for the furthest isolated partition
root ancestor instead to decide if its isolated CPUs should be returned
to isolated_cpus.

Fixes: 46b885416c27 ("cgroup/cpuset: Fix a missing isolated_cpus update in update_cpumasks_hier()")
Signed-off-by: Waiman Long <longman@xxxxxxxxxx>
---
  kernel/cgroup/cpuset.c | 36 +++++++++++++++++-------------------
  1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 585a982249ad..7ead8c3b7974 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2156,22 +2156,20 @@ static void compute_partition_effective_cpumask(struct cpuset *cs,
  }
    /*
- * ancestor_partition - Find and return the closest valid partition root ancestor
+ * iancestor_partition - Return furthest isolated partition root ancestor available
   * @cs: the current cpuset
- *
- * Return: The closet partition root ancestor cpuset
+ * Return: The furthest isolated partition root ancestor available or NULL if
+ *       not found.
   */
-static struct cpuset *ancestor_partition(struct cpuset *cs)
+static struct cpuset *iancestor_partition(struct cpuset *cs)

Nit.

iancestor is confusing.
Can we renmae it furthest_isolated_ancestor?

Yes, I can make the name change. Thanks for the suggestion.

Cheers,
Longman