summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorWaiman Long <longman@redhat.com>2026-10-25 17:44:43 -0400
committerTejun Heo <tj@kernel.org>2026-10-26 07:44:23 -1000
commit40a0d5c05a2be7b1c23c32f1327289d26d479ae6 (patch)
tree928cbba314a51157ec8d3ed94f0fe4b52696c930 /tools/testing
parent40702b2ca8fa08fb64b926d8c72a4909d0330580 (diff)
selftests/cgroup: Check for a single range nohz_full CPUs before running test matrix
Commit 989ca25c10ca ("selftests/cgroup: Add tests for nohz_full housekeeping check") adds a nohz_full test matrix that will only be run when a nohz_full boot parameter cover all the CPUs beyond CPUs 0-7. The code looks for the first and last CPU numbers in the nohz_full sysfs file to determine if that criterion is met. However if there are holes in the range (i.e. has ",") the test matrix may be incorrectly run leading to unexpected test failure. Fix that by skipping "," and anything after that to make sure the first range will cover all the remaining CPUs. Reviewed-by: Guopeng Zhang <zhangguopeng@kylinos.cn> Tested-by: Guopeng Zhang <zhangguopeng@kylinos.cn> Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/testing')
-rwxr-xr-xtools/testing/selftests/cgroup/test_cpuset_prs.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index fe7a776107dd..f09a0a78ead2 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -111,9 +111,9 @@ echo "" > test/cpuset.cpus
#
# 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.
+# set of nohz_full CPUs includes all the CPUs except 0-7 in a single range
+# <first>-<last>, 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=
@@ -124,7 +124,7 @@ NOHZ_FULL_CPUS=
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/.*[,-]//")
+ LAST_NOHZ_FULL_CPU=$(echo $NOHZ_FULL_CPUS | sed -e "s/,.*//;s/.*[-]//")
echo "Boot nohz_full CPUs: $NOHZ_FULL_CPUS"
}
[[ -n "$FIRST_NOHZ_FULL_CPU" && "$FIRST_NOHZ_FULL_CPU" -le 7 ]] &&