diff options
| author | Davidlohr Bueso <[email protected]> | 2021-08-09 04:33:00 +0000 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <[email protected]> | 2021-08-09 15:00:22 +0000 |
| commit | 6f9661b25b1741b180bdaeb85853905078cfd9d8 (patch) | |
| tree | 708b4bea72991c14a7e55a2705be8c3bead1ec75 /tools/perf/bench/futex-requeue.c | |
| parent | perf bench futex, requeue: Add --broadcast option (diff) | |
| download | kernel-6f9661b25b1741b180bdaeb85853905078cfd9d8.tar.gz kernel-6f9661b25b1741b180bdaeb85853905078cfd9d8.zip | |
perf bench futex, requeue: Robustify futex_wait() handling
Do not assume success and account for EAGAIN or any other return value,
however unlikely.
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 | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/perf/bench/futex-requeue.c b/tools/perf/bench/futex-requeue.c index 6606569e7ccc..e23a08037de2 100644 --- a/tools/perf/bench/futex-requeue.c +++ b/tools/perf/bench/futex-requeue.c @@ -77,6 +77,8 @@ static void print_summary(void) static void *workerfn(void *arg __maybe_unused) { + int ret; + pthread_mutex_lock(&thread_lock); threads_starting--; if (!threads_starting) @@ -84,7 +86,18 @@ static void *workerfn(void *arg __maybe_unused) pthread_cond_wait(&thread_worker, &thread_lock); pthread_mutex_unlock(&thread_lock); - futex_wait(&futex1, 0, NULL, futex_flag); + while (1) { + ret = futex_wait(&futex1, 0, NULL, futex_flag); + if (!ret) + break; + + if (ret && errno != EAGAIN) { + if (!params.silent) + warn("futex_wait"); + break; + } + } + return NULL; } |
