perf bench: Move HAVE_PTHREAD_ATTR_SETAFFINITY_NP into bench.h
authorDavidlohr Bueso <dave@stgolabs.net>
Fri, 9 Nov 2018 21:07:19 +0000 (13:07 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 21 Nov 2018 15:00:32 +0000 (12:00 -0300)
Both futex and epoll need this call, and can cause build failure on
systems that don't have it pthread_attr_setaffinity_np().

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Davidlohr Bueso <dbueso@suse.de>
Cc: Jason Baron <jbaron@akamai.com>
Link: http://lkml.kernel.org/r/20181109210719.pr7ohayuwqmfp2wl@linux-r8p5
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/bench/bench.h
tools/perf/bench/futex.h

index 6c9fcd757f31061d59a94d052c74a6b7aa9a6f0e..8299c76046cd62697b88e7a4ea9fcada69f524b4 100644 (file)
@@ -48,4 +48,15 @@ int bench_futex_lock_pi(int argc, const char **argv);
 extern int bench_format;
 extern unsigned int bench_repeat;
 
+#ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP
+#include <pthread.h>
+#include <linux/compiler.h>
+static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused,
+                                             size_t cpusetsize __maybe_unused,
+                                             cpu_set_t *cpuset __maybe_unused)
+{
+       return 0;
+}
+#endif
+
 #endif
index db4853f209c7665bc2bc86fa786225fb1a9bfa5d..31b53cc7d5bc7733a5385d7c9ee7e2d37a967cc8 100644 (file)
@@ -86,16 +86,4 @@ futex_cmp_requeue(u_int32_t *uaddr, u_int32_t val, u_int32_t *uaddr2, int nr_wak
        return futex(uaddr, FUTEX_CMP_REQUEUE, nr_wake, nr_requeue, uaddr2,
                 val, opflags);
 }
-
-#ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP
-#include <pthread.h>
-#include <linux/compiler.h>
-static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused,
-                                             size_t cpusetsize __maybe_unused,
-                                             cpu_set_t *cpuset __maybe_unused)
-{
-       return 0;
-}
-#endif
-
 #endif /* _FUTEX_H */