From d262e6a93b3ceb3db7e6388d89352801f02c3260 Mon Sep 17 00:00:00 2001 From: Davidlohr Bueso Date: Sun, 8 Aug 2021 21:32:59 -0700 Subject: [PATCH] perf bench futex, requeue: Add --broadcast option Such that all threads are requeued to uaddr2 in a single futex_cmp_requeue(), unlike the default, which is 1. Signed-off-by: Davidlohr Bueso Cc: Davidlohr Bueso Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lore.kernel.org/lkml/20210809043301.66002-6-dave@stgolabs.net Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/bench/futex-requeue.c | 4 ++++ tools/perf/bench/futex.h | 1 + 2 files changed, 5 insertions(+) diff --git a/tools/perf/bench/futex-requeue.c b/tools/perf/bench/futex-requeue.c index 73d4a6c3fe52..6606569e7ccc 100644 --- a/tools/perf/bench/futex-requeue.c +++ b/tools/perf/bench/futex-requeue.c @@ -53,6 +53,7 @@ static const struct option options[] = { OPT_BOOLEAN( 's', "silent", ¶ms.silent, "Silent mode: do not display data/details"), OPT_BOOLEAN( 'S', "shared", ¶ms.fshared, "Use shared futexes instead of private ones"), OPT_BOOLEAN( 'm', "mlockall", ¶ms.mlockall, "Lock all current and future memory"), + OPT_BOOLEAN( 'B', "broadcast", ¶ms.broadcast, "Requeue all threads at once"), OPT_END() }; @@ -154,6 +155,9 @@ int bench_futex_requeue(int argc, const char **argv) if (params.nrequeue > params.nthreads) params.nrequeue = params.nthreads; + if (params.broadcast) + params.nrequeue = params.nthreads; + printf("Run summary [PID %d]: Requeuing %d threads (from [%s] %p to %p), " "%d at a time.\n\n", getpid(), params.nthreads, params.fshared ? "shared":"private", &futex1, &futex2, params.nrequeue); diff --git a/tools/perf/bench/futex.h b/tools/perf/bench/futex.h index fca4eee5e040..40a89f192c53 100644 --- a/tools/perf/bench/futex.h +++ b/tools/perf/bench/futex.h @@ -18,6 +18,7 @@ struct bench_futex_parameters { bool fshared; bool mlockall; bool multi; /* lock-pi */ + bool broadcast; /* requeue */ unsigned int runtime; /* seconds*/ unsigned int nthreads; unsigned int nfutexes; -- 2.25.1