From: Sun Yuechi Date: Tue, 16 Jun 2026 06:13:22 +0000 (+0800) Subject: run-make-check.sh: build ctest cpu resource pool from sched_getaffinity X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2bb17b80aa4c5813b6a8fc78fc0e2410b746a76b;p=ceph.git run-make-check.sh: build ctest cpu resource pool from sched_getaffinity gen_ctest_resource_file assumed online CPUs are a contiguous 0..nproc-1 range. When a middle core is hot-offlined (e.g. for a hardware fault), that both hands out the offline cpu id and drops an online one; crimson seastar unittests feed the ctest resource id straight to seastar --cpuset, so hitting the offline id aborts with "Bad value for --cpuset: N not allowed". Use the CPUs actually schedulable by the process via sched_getaffinity(). Signed-off-by: Sun Yuechi --- diff --git a/run-make-check.sh b/run-make-check.sh index 264cac65c18..2c420f3dad1 100755 --- a/run-make-check.sh +++ b/run-make-check.sh @@ -24,9 +24,12 @@ set -e function gen_ctest_resource_file() { local file_name=$(mktemp /tmp/ctest-resource-XXXXXX) - local max_cpuid=$(($(nproc) - 1)) + # Usable CPU ids for this process: excludes offline cores and honors cgroup/ + # taskset limits. Not necessarily contiguous 0..nproc-1, so a crimson seastar + # unittest could otherwise get an offline id in --cpuset and abort. + local ids=$(python3 -c 'import os; print(*sorted(os.sched_getaffinity(0)))') jq -n '$ARGS.positional | map({id:., slots:1}) | {cpus:.} | {version: {major:1, minor:0}, local:[.]}' \ - --args $(seq 0 $max_cpuid) > $file_name + --args $ids > $file_name echo "$file_name" }