Merge tag 'mac80211-for-john-2014-11-04' of git://git.kernel.org/pub/scm/linux/kernel...
[firefly-linux-kernel-4.4.55.git] / tools / perf / bench / futex-hash.c
index a84206e9c4aa09b97bb2dddc5c00a598234abd2c..fc9bebd2cca0575734f84f9947bf29f7f991c6ab 100644 (file)
@@ -26,6 +26,7 @@ static unsigned int nsecs    = 10;
 /* amount of futexes per thread */
 static unsigned int nfutexes = 1024;
 static bool fshared = false, done = false, silent = false;
+static int futex_flag = 0;
 
 struct timeval start, end, runtime;
 static pthread_mutex_t thread_lock;
@@ -75,8 +76,7 @@ static void *workerfn(void *arg)
                         * such as internal waitqueue handling, thus enlarging
                         * the critical region protected by hb->lock.
                         */
-                       ret = futex_wait(&w->futex[i], 1234, NULL,
-                                        fshared ? 0 : FUTEX_PRIVATE_FLAG);
+                       ret = futex_wait(&w->futex[i], 1234, NULL, futex_flag);
                        if (!silent &&
                            (!ret || errno != EAGAIN || errno != EWOULDBLOCK))
                                warn("Non-expected futex return call");
@@ -135,6 +135,9 @@ int bench_futex_hash(int argc, const char **argv,
        if (!worker)
                goto errmem;
 
+       if (!fshared)
+               futex_flag = FUTEX_PRIVATE_FLAG;
+
        printf("Run summary [PID %d]: %d threads, each operating on %d [%s] futexes for %d secs.\n\n",
               getpid(), nthreads, nfutexes, fshared ? "shared":"private", nsecs);