Re: [PATCH 5/7] perf/bench-futex, requeue: Add --broadcast option

From: Arnaldo Carvalho de Melo
Date: Mon Aug 09 2021 - 10:57:09 EST


Em Sun, Aug 08, 2021 at 09:32:59PM -0700, Davidlohr Bueso escreveu:
> Such that all threads are requeued to uaddr2 in a single
> futex_cmp_requeue(), unlike the default, which is 1.

Thanks, applied.

- Arnaldo


> Signed-off-by: Davidlohr Bueso <dbueso@xxxxxxx>
> ---
> 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 88cb7e2a6729..80f40ee92b53 100644
> --- a/tools/perf/bench/futex-requeue.c
> +++ b/tools/perf/bench/futex-requeue.c
> @@ -52,6 +52,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()
> };
>
> @@ -153,6 +154,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 1c8fa469993f..36f158650edf 100644
> --- a/tools/perf/bench/futex.h
> +++ b/tools/perf/bench/futex.h
> @@ -21,6 +21,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.26.2
>

--

- Arnaldo