diff options
author | Athira Rajeev <atrajeev@linux.vnet.ibm.com> | 2024-06-07 06:43:52 +0200 |
---|---|---|
committer | Namhyung Kim <namhyung@kernel.org> | 2024-06-14 06:26:58 +0200 |
commit | 183373586743a73da51b505ae3f4e5eb6300f208 (patch) | |
tree | ade11ab8d9e18e03c38067dd19e648a8e317e287 /tools/perf/bench/futex-wake-parallel.c | |
parent | perf record: Ensure space for lost samples (diff) | |
download | linux-183373586743a73da51b505ae3f4e5eb6300f208.tar.xz linux-183373586743a73da51b505ae3f4e5eb6300f208.zip |
tools/perf: Fix perf bench futex to enable the run when some CPU's are offline
Perf bench futex fails as below when attempted to run on
on a powerpc system:
./perf bench futex all
Running futex/hash benchmark...
Run summary [PID 626307]: 80 threads, each operating on 1024 [private] futexes for 10 secs.
perf: pthread_create: No such file or directory
In the setup where this perf bench was ran, difference was that
partition had 640 CPU's, but not all CPUs were online. 80 CPUs
were online. While blocking the threads with futex_wait, code
sets the affinity using cpumask. The cpumask size used is 80
which is picked from "nrcpus = perf_cpu_map__nr(cpu)". Here the
benchmark reports fail while setting affinity for cpu number which
is greater than 80 or higher, because it attempts to set a bit
position which is not allocated on the cpumask. Fix this by changing
the size of cpumask to number of possible cpus and not the number
of online cpus.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Tested-by: Disha Goel <disgoel@linux.ibm.com>
Cc: akanksha@linux.ibm.com
Cc: kjain@linux.ibm.com
Cc: maddy@linux.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240607044354.82225-1-atrajeev@linux.vnet.ibm.com
Diffstat (limited to 'tools/perf/bench/futex-wake-parallel.c')
-rw-r--r-- | tools/perf/bench/futex-wake-parallel.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/bench/futex-wake-parallel.c b/tools/perf/bench/futex-wake-parallel.c index b66df553e561..90a5b91bf139 100644 --- a/tools/perf/bench/futex-wake-parallel.c +++ b/tools/perf/bench/futex-wake-parallel.c @@ -149,7 +149,7 @@ static void block_threads(pthread_t *w, struct perf_cpu_map *cpu) { cpu_set_t *cpuset; unsigned int i; - int nrcpus = perf_cpu_map__nr(cpu); + int nrcpus = cpu__max_cpu().cpu; size_t size; threads_starting = params.nthreads; |