perf bench futex, requeue: Add --broadcast option
authorDavidlohr Bueso <dave@stgolabs.net>
Mon, 9 Aug 2021 04:32:59 +0000 (21:32 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 9 Aug 2021 15:00:10 +0000 (12:00 -0300)
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 <dbueso@suse.de>
Cc: Davidlohr Bueso <dbueso@suse.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lore.kernel.org/lkml/20210809043301.66002-6-dave@stgolabs.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/bench/futex-requeue.c
tools/perf/bench/futex.h

index 73d4a6c3fe52f2749291e564c19f2ca9c854087a..6606569e7ccc38267816f5cfac7f2b33ce37f078 100644 (file)
@@ -53,6 +53,7 @@ static const struct option options[] = {
        OPT_BOOLEAN( 's', "silent",   &params.silent, "Silent mode: do not display data/details"),
        OPT_BOOLEAN( 'S', "shared",   &params.fshared, "Use shared futexes instead of private ones"),
        OPT_BOOLEAN( 'm', "mlockall", &params.mlockall, "Lock all current and future memory"),
+       OPT_BOOLEAN( 'B', "broadcast", &params.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);
index fca4eee5e04064a28527051b11b730e6e9232ec8..40a89f192c53529f93aaf7f9ae0bed7ad8c9ba3b 100644 (file)
@@ -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;