summaryrefslogtreecommitdiffstats
path: root/tools/perf/bench/futex-hash.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-01-24 12:37:43 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-01-24 12:37:43 -0800
commit0cce284537fb42d9c28b9b31038ffc9b464555f5 (patch)
treee7af3b5fe2d04ef6527b5da50851d498ee13184e /tools/perf/bench/futex-hash.c
parentcefb26d4b37c329f624eb235a1bdc7b6b8dd9430 (diff)
parent7a308bb3016f57e5be11a677d15b821536419d36 (diff)
downloadblackbird-obmc-linux-0cce284537fb42d9c28b9b31038ffc9b464555f5.tar.gz
blackbird-obmc-linux-0cce284537fb42d9c28b9b31038ffc9b464555f5.zip
Merge tag 'v4.10-rc5' into next
Sync up with mainline to bring up improvements in various subsystems.
Diffstat (limited to 'tools/perf/bench/futex-hash.c')
-rw-r--r--tools/perf/bench/futex-hash.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/perf/bench/futex-hash.c b/tools/perf/bench/futex-hash.c
index 8024cd5febd2..bfbb6b5f609c 100644
--- a/tools/perf/bench/futex-hash.c
+++ b/tools/perf/bench/futex-hash.c
@@ -63,8 +63,9 @@ static const char * const bench_futex_hash_usage[] = {
static void *workerfn(void *arg)
{
int ret;
- unsigned int i;
struct worker *w = (struct worker *) arg;
+ unsigned int i;
+ unsigned long ops = w->ops; /* avoid cacheline bouncing */
pthread_mutex_lock(&thread_lock);
threads_starting--;
@@ -74,7 +75,7 @@ static void *workerfn(void *arg)
pthread_mutex_unlock(&thread_lock);
do {
- for (i = 0; i < nfutexes; i++, w->ops++) {
+ for (i = 0; i < nfutexes; i++, ops++) {
/*
* We want the futex calls to fail in order to stress
* the hashing of uaddr and not measure other steps,
@@ -88,6 +89,7 @@ static void *workerfn(void *arg)
}
} while (!done);
+ w->ops = ops;
return NULL;
}
@@ -128,6 +130,8 @@ int bench_futex_hash(int argc, const char **argv,
}
ncpus = sysconf(_SC_NPROCESSORS_ONLN);
+ nsecs = futexbench_sanitize_numeric(nsecs);
+ nfutexes = futexbench_sanitize_numeric(nfutexes);
sigfillset(&act.sa_mask);
act.sa_sigaction = toggle_done;
@@ -135,6 +139,8 @@ int bench_futex_hash(int argc, const char **argv,
if (!nthreads) /* default to the number of CPUs */
nthreads = ncpus;
+ else
+ nthreads = futexbench_sanitize_numeric(nthreads);
worker = calloc(nthreads, sizeof(*worker));
if (!worker)
OpenPOWER on IntegriCloud