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

perf bench numa: Fix to show proper convergence stats

With commit: e1e455f4f4d3 (perf tools: Work around lack of sched_getcpu
in glibc < 2.6), perf_bench numa mem with -c or -m option is not able to
correctly calculate convergence.

With the above commit, sched_getcpu always seems to return -1. The
intention of commit e1e455f was to add a sched_getcpu in glibc < 2.6.
Hence keep the sched_getcpu definition under an ifdef.

This regression happened occurred between v4.0 and v4.1

Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Vinson Lee <vlee@twitter.com>
Fixes: e1e455f4f4d3 ("perf tools: Work around lack of sched_getcpu in glibc < 2.6")
Link: http://lkml.kernel.org/r/20150624111004.GA5220@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Srikar Dronamraju and committed by
Arnaldo Carvalho de Melo
2b42b09b 0f02adaa

+4
+4
tools/perf/util/cloexec.c
··· 7 7 8 8 static unsigned long flag = PERF_FLAG_FD_CLOEXEC; 9 9 10 + #ifdef __GLIBC_PREREQ 11 + #if !__GLIBC_PREREQ(2, 6) 10 12 int __weak sched_getcpu(void) 11 13 { 12 14 errno = ENOSYS; 13 15 return -1; 14 16 } 17 + #endif 18 + #endif 15 19 16 20 static int perf_flag_probe(void) 17 21 {