Skip to content

Commit 824e3c4

Browse files
committed
wip
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent ede2ac5 commit 824e3c4

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

scripts/bench-taskset.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@ fi
1818

1919

2020
if [[ -z "${BENCH_CPUS:-}" ]]; then
21-
cpu_count="$(nproc)"
22-
BENCH_CPUS="2-$((cpu_count - 1))"
21+
if command -v numactl >/dev/null 2>&1; then
22+
# All CPUs on NUMA node 0, skipping CPUs 0-1 to avoid OS interference
23+
BENCH_CPUS=$(numactl --hardware | awk '/^node 0 cpus:/{sep=""; for(i=4;i<=NF;i++){if($i+0>1){printf "%s%s",sep,$i; sep=","}}}')
24+
else
25+
cpu_count="$(nproc)"
26+
BENCH_CPUS="2-$((cpu_count - 1))"
27+
fi
2328
fi
2429

2530
if command -v numactl >/dev/null 2>&1; then
26-
exec numactl --physcpubind="$BENCH_CPUS" --localalloc "$@"
31+
exec numactl --physcpubind="$BENCH_CPUS" --membind=0 "$@"
2732
fi
2833

2934
exec taskset -c "$BENCH_CPUS" "$@"

0 commit comments

Comments
 (0)