[PATCH 2/2] selftests/cgroup: Test partition switches after a sibling releases CPUs
From: Hang Zhengyang
Date: Thu Dec 03 2026 - 14:59:45 EST
Add two cases each to TEST_MATRIX and REMOTE_TEST_MATRIX. A sibling
releases its exclusive CPUs 3-4, then a partition with cpuset.cpus 2-5
is switched from root to isolated or back. It should take CPUs 3-4 from
its parent, which leaves CPU 1 to the member cpusets next to it.
Without the previous patch, the parent keeps CPUs 3-4 and the new cases
fail.
Signed-off-by: Hang Zhengyang <hang.zhengyang1010@xxxxxxxxx>
---
tools/testing/selftests/cgroup/test_cpuset_prs.sh | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index 1397ec428c46..fb3d1440d1e8 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -440,6 +440,11 @@ TEST_MATRIX=(
" CX2-3:P1 . . C3 T:O2=0:O3=0:X . . X3 0 XA1:|XB1:3 A1:P-1"
" CX2-3:P1 X3 . C3 T:O2=0:O3=0:X . . X3 0 XA1:|XA2:|XB1:3 A1:P-1"
+ # Switching a partition between root and isolated after a sibling
+ # released its exclusive CPUs takes those CPUs from the parent.
+ " C1-4:X3-4 . . C2-5:P1 X . . P2 0 A1:1|B1:2-5 B1:P2 2-5"
+ " C1-4:X3-4 . . C2-5:P2 X . . P1 0 A1:1|B1:2-5 B1:P1 ."
+
# A child cannot recover until its exclusive CPUs are available again.
" CX1-4:P1 CX3-4:P1 . . X1-2 . . . 0 A1:1-2|A2:1-2|XA2: A1:P1|A2:P-1"
" CX1-4:P1 CX3-4:P1 . . X1-2:X1-4 . . . 0 A1:1-2|A2:3-4|XA2:3-4 A1:P1|A2:P1"
@@ -712,6 +717,15 @@ REMOTE_TEST_MATRIX=(
" CX2-3:T . C2-3:X2:P1 . . . \
. . X2-3 . . . p1:1,4-7|c11:2-3 \
p1:P0|c11:P1"
+ # Switching a remote partition between root and isolated after a
+ # sibling released its exclusive CPUs takes those CPUs from the top
+ # cpuset.
+ " CX1-5 . X3-4 C2-5:P1 . . \
+ . . X P2 . . p1:1|c11:1|c12:2-5 \
+ p1:P0|c11:P0|c12:P2 2-5"
+ " CX1-5 . X3-4 C2-5:P2 . . \
+ . . X P1 . . p1:1|c11:1|c12:2-5 \
+ p1:P0|c11:P0|c12:P1 ."
)
#
--
2.53.0