[PATCH 2/8] perf bench futex: Set the number of hash buckets in futex wake
From: Michal Pluta
Date: Sat Sep 26 2026 - 15:05:34 EST
'perf bench futex wake -b N' fails unless N happens to be the number of
buckets the kernel is already using:
$ perf bench futex wake -b 128
Requested number of hash buckets does not currently used.
Requested: 128 in usage: 64
perf: prctl(PR_FUTEX_HASH): No such file or directory
The other futex benchmarks call futex_set_nbuckets_param() to ask the
kernel for the requested size, but 'futex wake' only checks afterwards
which size is in use, so the request never reaches the kernel. The call
now happens before the run summary, as in the other benchmarks.
Fixes: 60035a3981a7 ("tools/perf: Allow to select the number of hash buckets")
Assisted-by: LLM
Signed-off-by: Michal Pluta <michalpl2003@xxxxxxxxx>
---
tools/perf/bench/futex-wake.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/bench/futex-wake.c b/tools/perf/bench/futex-wake.c
index 66d30ca91405..58427bb55c03 100644
--- a/tools/perf/bench/futex-wake.c
+++ b/tools/perf/bench/futex-wake.c
@@ -175,6 +175,8 @@ int bench_futex_wake(int argc, const char **argv)
if (!params.fshared)
futex_flag = FUTEX_PRIVATE_FLAG;
+ futex_set_nbuckets_param(¶ms);
+
printf("Run summary [PID %d]: blocking on %d threads (at [%s] futex %p), "
"waking up %d at a time.\n\n",
getpid(), params.nthreads, params.fshared ? "shared":"private",
--
2.43.0