Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf bench: Move HAVE_PTHREAD_ATTR_SETAFFINITY_NP into bench.h

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>

authored by

Davidlohr Bueso and committed by
Arnaldo Carvalho de Melo
d47d77c3 9add8fe8

+11 -12
+11
tools/perf/bench/bench.h
··· 48 48 extern int bench_format; 49 49 extern unsigned int bench_repeat; 50 50 51 + #ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP 52 + #include <pthread.h> 53 + #include <linux/compiler.h> 54 + static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused, 55 + size_t cpusetsize __maybe_unused, 56 + cpu_set_t *cpuset __maybe_unused) 57 + { 58 + return 0; 59 + } 60 + #endif 61 + 51 62 #endif
-12
tools/perf/bench/futex.h
··· 86 86 return futex(uaddr, FUTEX_CMP_REQUEUE, nr_wake, nr_requeue, uaddr2, 87 87 val, opflags); 88 88 } 89 - 90 - #ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP 91 - #include <pthread.h> 92 - #include <linux/compiler.h> 93 - static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused, 94 - size_t cpusetsize __maybe_unused, 95 - cpu_set_t *cpuset __maybe_unused) 96 - { 97 - return 0; 98 - } 99 - #endif 100 - 101 89 #endif /* _FUTEX_H */