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

From: Waiman Long

Date: Thu Oct 22 2026 - 12:24:59 EST


On 10/22/26 9:25 AM, Guopeng Zhang wrote:

在 2026/10/22 11:16, Waiman Long 写道:
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.

This looks good to me. Would it be worth adding a test case for the
scenario described above, something like:

# A middle isolated parent shrunk below coverage: the released
# CPUs of the invalidated child stay isolated as a higher
# ancestor still covers them.
" CX0-4:P2 CX2-4:P2 CX3-4:P2 . . X2 . . 0 A1:0-1,3-4|A2:2|A3:2 A1:P2|A2:P2|A3:P-2 0-4"

Reviewed-by: Guopeng Zhang <zhangguopeng@xxxxxxxxxx>
Tested-by: Guopeng Zhang <zhangguopeng@xxxxxxxxxx>

Thanks,
Guopeng

Thanks for the review. This patch fixes a specific problem reported by sashiko. However, there are other pre-existing problem that will still fail test case that you have proposed above. Patches 2 & 3 of this series are there to address the other existing problems so that test cases like what you have proposed above will work. The first test case added in patch 2 was to test this though it is somewhat different from yours. I don't add any test case to patch 1 because I don't want to break bisection. I can add your test case in patch 2 though.

Cheers,
Longman