diff options
| author | Davidlohr Bueso <[email protected]> | 2021-08-09 04:32:58 +0000 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <[email protected]> | 2021-08-09 15:00:04 +0000 |
| commit | 9f9a3ffe94f263388b99cb75e4ec374e31aaeb0f (patch) | |
| tree | bc35c452426a5763e94488dc91377a2683f4ef1b /tools/perf/bench/futex-requeue.c | |
| parent | perf bench futex: Remove bogus backslash from comment (diff) | |
| download | kernel-9f9a3ffe94f263388b99cb75e4ec374e31aaeb0f.tar.gz kernel-9f9a3ffe94f263388b99cb75e4ec374e31aaeb0f.zip | |
perf bench futex: Add --mlockall parameter
This adds, across all futex benchmarks, the -m/--mlockall option
which is a common operation for realtime workloads by not incurring
in page faults in paths that want determinism. As such, threads
started after a call to mlockall(2) will generate page faults
immediately since the new stack is immediately forced to memory,
due to the MCL_FUTURE flag.
Signed-off-by: Davidlohr Bueso <[email protected]>
Cc: Davidlohr Bueso <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/bench/futex-requeue.c')
| -rw-r--r-- | tools/perf/bench/futex-requeue.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/bench/futex-requeue.c b/tools/perf/bench/futex-requeue.c index 66747bfe22cf..73d4a6c3fe52 100644 --- a/tools/perf/bench/futex-requeue.c +++ b/tools/perf/bench/futex-requeue.c @@ -27,6 +27,7 @@ #include <err.h> #include <stdlib.h> #include <sys/time.h> +#include <sys/mman.h> static u_int32_t futex1 = 0, futex2 = 0; @@ -51,6 +52,7 @@ static const struct option options[] = { OPT_UINTEGER('q', "nrequeue", ¶ms.nrequeue, "Specify amount of threads to requeue at once"), 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_END() }; @@ -134,6 +136,11 @@ int bench_futex_requeue(int argc, const char **argv) act.sa_sigaction = toggle_done; sigaction(SIGINT, &act, NULL); + if (params.mlockall) { + if (mlockall(MCL_CURRENT | MCL_FUTURE)) + err(EXIT_FAILURE, "mlockall"); + } + if (!params.nthreads) params.nthreads = cpu->nr; |
