X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=libringbuffer%2Fsmp.h;h=479a9dc60a01c9810d166ed1944e8fc7dfb4ecb0;hb=HEAD;hp=755c65fc52fb53e91ee59ddbd415cc0468cec2bf;hpb=4318ae1be57eb7983ab4857a7a8eeb4a030a8216;p=lttng-ust.git diff --git a/libringbuffer/smp.h b/libringbuffer/smp.h deleted file mode 100644 index 755c65fc..00000000 --- a/libringbuffer/smp.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef _LIBRINGBUFFER_SMP_H -#define _LIBRINGBUFFER_SMP_H - -/* - * libringbuffer/smp.h - * - * Copyright 2011 (c) - Mathieu Desnoyers - * - * Dual LGPL v2.1/GPL v2 license. - */ - -#include - -/* - * 4kB of per-cpu data available. Enough to hold the control structures, - * but not ring buffers. - */ -#define PER_CPU_MEM_SIZE 4096 - -extern int __num_possible_cpus; -extern void _get_num_possible_cpus(void); - -static inline -int num_possible_cpus(void) -{ - if (!__num_possible_cpus) - _get_num_possible_cpus(); - 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)++) - -#endif /* _LIBRINGBUFFER_SMP_H */