mirror of
https://github.com/ceph/ceph
synced 2026-08-02 07:03:18 +00:00
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 <sunyuechi@iscas.ac.cn>
This commit is contained in:
parent
2286265c0a
commit
2bb17b80aa
@ -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"
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user