summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWaiman Long <longman@redhat.com>2026-10-19 14:10:19 -0400
committerTejun Heo <tj@kernel.org>2026-10-19 13:08:20 -1000
commit989ca25c10ca8a0904ae0f7a27f4eeac0d573dcb (patch)
tree5f2e5fc6a9762db7e5066b8f6ef284c06f4e901d /tools
parent1f14d20bf330c8968f32b2d9eb1df90e47c33ca0 (diff)
selftests/cgroup: Add tests for nohz_full housekeeping check
When a boot time nohz_full CPUs are present and they cover CPUs 0-7, some of the test cases may fail. So the test run will be skipped with a warning message in this case. On the other hand, if the boot time nohz_full CPUs cover all the CPUs except 0-7, a special set of nohz_full specific housekeeping check related tests could be run to make sure the housekeeping check are behaving properly. The test_cpuset_prs.sh test script is now updated to do exactly that. Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/cgroup/test_cpuset_prs.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index cd179854ecd5..7639e9f11cf9 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -85,6 +85,31 @@ echo "" > test/cpuset.cpus
[[ $RESULT -eq 0 ]] && skip_test "Child cgroups are using cpuset!"
#
+# If nohz_full CPUs have been reserved at boot time, they should not include
+# CPUs 0-7 as that may fail some of the test cases. On the other hand if the
+# set of nohz_full CPUs includes all the CPUs except 0-7, we can run a special
+# set of housekeeping CPUs exhaustion tests to see if the cpuset code will
+# reject them.
+#
+FIRST_NOHZ_FULL_CPU=
+LAST_NOHZ_FULL_CPU=
+RUN_NOHZ_FULL_TESTS=
+NOHZ_FULL_CPUS=
+[[ -f /sys/devices/system/cpu/nohz_full ]] &&
+ NOHZ_FULL_CPUS=$(cat /sys/devices/system/cpu/nohz_full)
+LAST_PRESENT_CPU=$(cat /sys/devices/system/cpu/present | sed -e "s/.*[,-]//")
+[[ -n "$NOHZ_FULL_CPUS" ]] && {
+ FIRST_NOHZ_FULL_CPU=$(echo $NOHZ_FULL_CPUS | sed -e "s/[,-].*//")
+ LAST_NOHZ_FULL_CPU=$(echo $NOHZ_FULL_CPUS | sed -e "s/.*[,-]//")
+ echo "Boot nohz_full CPUs: $NOHZ_FULL_CPUS"
+}
+[[ -n "$FIRST_NOHZ_FULL_CPU" && "$FIRST_NOHZ_FULL_CPU" -le 7 ]] &&
+ skip_test "Boot NOHZ_FULL CPUs overlap CPUs to be tested!"
+
+[[ -n "$FIRST_NOHZ_FULL_CPU" && "$FIRST_NOHZ_FULL_CPU" = 8 &&
+ "$LAST_NOHZ_FULL_CPU" = $LAST_PRESENT_CPU ]] && RUN_NOHZ_FULL_TESTS=1
+
+#
# If isolated CPUs have been reserved at boot time (as shown in
# /sys/devices/system/cpu/isolated), these isolated CPUs should be outside of
# CPUs 0-8 that will be used by this script for testing purpose. If not, some
@@ -500,6 +525,17 @@ ISOLCPUS_TEST_MATRIX=(
" CX1-2,I:X1,I:P1 . . . X1,2,I . . . 0 A1:1-2,I|XA1:1-2,I A1:P-1 ."
)
+# Test matrix to be run when boot time nohz_full CPUs cover all CPUs except CPUs 0-7
+NOHZ_FULL_TEST_MATRIX=(
+ # old-A1 old-A2 old-A3 old-B1 new-A1 new-A2 new-A3 new-B1 fail ECPUs Pstate ISOLCPUS
+ # ------ ------ ------ ------ ------ ------ ------ ------ ---- ----- ------ --------
+ # Using all the nohz_full HK CPUs 0-7 in isolated partition is not allowed
+ " C0-7 . . . P2 . . . 0 A1:0-7 A1:P-2 ."
+ " C2-7:P2 . . . C0-4 . . . 0 A1:0-4 A1:P2 0-4"
+ " C1-7:P2 C5-7:P2 . . . . . C0:P2 0 A1:1-4|A2:5-7|B1:0
+ A1:P2|A2:P2|B1:P-2 1-7"
+)
+
#
# Cpuset controller remote partition test matrix.
#
@@ -1365,6 +1401,7 @@ trap cleanup 0 2 3 6
run_state_test TEST_MATRIX
run_remote_state_test REMOTE_TEST_MATRIX
TEST_ISOLCPUS=1 run_state_test ISOLCPUS_TEST_MATRIX
+[[ -n "$RUN_NOHZ_FULL_TESTS" ]] && run_state_test NOHZ_FULL_TEST_MATRIX
test_isolated
test_boot_isolated
test_inotify