X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=libringbuffer%2Fsmp.h;h=bef3e0ef7ff467c01e6937b70bcf3608eb9f51ac;hb=2b2d6ff75efc17aa74ea9b0a7f8c756d812804bb;hp=755c65fc52fb53e91ee59ddbd415cc0468cec2bf;hpb=1af3d49e997e5585079ff917d2435e9380a071b7;p=lttng-ust.git diff --git a/libringbuffer/smp.h b/libringbuffer/smp.h index 755c65fc..bef3e0ef 100644 --- a/libringbuffer/smp.h +++ b/libringbuffer/smp.h @@ -10,6 +10,7 @@ */ #include +#include "getcpu.h" /* * 4kB of per-cpu data available. Enough to hold the control structures, @@ -28,45 +29,6 @@ int num_possible_cpus(void) return __num_possible_cpus; } -/* - * get_cpu() returns the current CPU number. It may change due to - * migration, so it is only statistically accurate. - */ -#ifndef UST_VALGRIND -static inline -int get_cpu(void) -{ - int cpu; - - cpu = sched_getcpu(); - if (caa_likely(cpu >= 0)) - return cpu; - /* - * If getcpu(2) is not implemented in the Kernel use CPU 0 as fallback. - */ - return 0; -} - -#else /* #else #ifndef UST_VALGRIND */ -static inline -int get_cpu(void) -{ - /* - * Valgrind does not support the sched_getcpu() vsyscall. - * It causes it to detect a segfault in the program and stop it. - * So if we want to check libust with valgrind, we have to refrain - * from using this call. TODO: it would probably be better to return - * other values too, to better test it. - */ - return 0; -} -#endif /* #else #ifndef UST_VALGRIND */ - -static inline -void put_cpu(void) -{ -} - #define for_each_possible_cpu(cpu) \ for ((cpu) = 0; (cpu) < num_possible_cpus(); (cpu)++)