Skip to content
Snippets Groups Projects
Commit 9d5f9988 authored by Tommi Rantala's avatar Tommi Rantala Committed by tangbin
Browse files

perf bench futex-wake: Restore thread count default to online CPU count

stable inclusion
from stable-v4.19.111
commit 5e8dff99645e574122aef5dec91b8803339a6362
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5QSAP
CVE: NA

--------------------------------
commit f649bd9d upstream.

Since commit 3b2323c2 ("perf bench futex: Use cpumaps") the default
number of threads the benchmark uses got changed from number of online
CPUs to zero:

  $ perf bench futex wake
  # Running 'futex/wake' benchmark:
  Run summary [PID 15930]: blocking on 0 threads (at [private] futex 0x558b8ee4bfac), waking up 1 at a time.
  [Run 1]: Wokeup 0 of 0 threads in 0.0000 ms
  [...]
  [Run 10]: Wokeup 0 of 0 threads in 0.0000 ms
  Wokeup 0 of 0 threads in 0.0004 ms (+-40.82%)

Restore the old behavior by grabbing the number of online CPUs via
cpu->nr:

  $ perf bench futex wake
  # Running 'futex/wake' benchmark:
  Run summary [PID 18356]: blocking on 8 threads (at [private] fut...
parent 8ea16c0e
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@ static bool done = false, silent = false, fshared = false;
static pthread_mutex_t thread_lock;
static pthread_cond_t thread_parent, thread_worker;
static struct stats waketime_stats, wakeup_stats;
static unsigned int ncpus, threads_starting, nthreads = 0;
static unsigned int threads_starting, nthreads = 0;
static int futex_flag = 0;
static const struct option options[] = {
......@@ -140,7 +140,7 @@ int bench_futex_wake(int argc, const char **argv)
sigaction(SIGINT, &act, NULL);
if (!nthreads)
nthreads = ncpus;
nthreads = cpu->nr;
worker = calloc(nthreads, sizeof(*worker));
if (!worker)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment