[PATCH 7/8] perf bench futex: Clean up two nits in futex hash
From: Michal Pluta
Date: Sat Sep 26 2026 - 15:05:23 EST
The worker's check for an unexpected futex_wait() result tests
'errno != EAGAIN || errno != EWOULDBLOCK', which only works because the
two are equal, so use '&&' instead.
The CPU map is reference counted, so release it with perf_cpu_map__put()
instead of free().
Assisted-by: LLM
Signed-off-by: Michal Pluta <michalpl2003@xxxxxxxxx>
---
tools/perf/bench/futex-hash.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/bench/futex-hash.c b/tools/perf/bench/futex-hash.c
index e18d98664d27..6f4af1a52d1b 100644
--- a/tools/perf/bench/futex-hash.c
+++ b/tools/perf/bench/futex-hash.c
@@ -95,7 +95,7 @@ static void *workerfn(void *arg)
*/
ret = futex_wait(&w->futex[i], 1234, NULL, futex_flag);
if (!params.silent &&
- (!ret || errno != EAGAIN || errno != EWOULDBLOCK))
+ (!ret || (errno != EAGAIN && errno != EWOULDBLOCK)))
warn("Non-expected futex return call");
}
} while (!done);
@@ -256,7 +256,7 @@ int bench_futex_hash(int argc, const char **argv)
print_summary();
free(worker);
- free(cpu);
+ perf_cpu_map__put(cpu);
return ret;
errmem:
err(EXIT_FAILURE, "calloc");
--
2.43.0