4 #include <lwk/string.h>
5 #include <arch/percpu.h>
7 /* Enough to cover all DEFINE_PER_CPU()'s in kernel. */
8 #ifndef PERCPU_ENOUGH_ROOM
9 #define PERCPU_ENOUGH_ROOM 32768
12 /* Must be an lvalue. */
13 #define get_cpu_var(var) __get_cpu_var(var)
14 #define put_cpu_var(var)
21 * Use this to get to a cpu's version of the per-cpu object allocated using
22 * alloc_percpu. Non-atomic access to the current CPU's version should
23 * probably be combined with get_cpu()/put_cpu().
25 #define per_cpu_ptr(ptr, cpu) \
27 struct percpu_data *__p = (struct percpu_data *)~(unsigned long)(ptr); \
28 (__typeof__(ptr))__p->ptrs[(cpu)]; \
31 extern void *__alloc_percpu(size_t size);
32 extern void free_percpu(const void *);
34 /* Simple wrapper for the common case: zeros memory. */
35 #define alloc_percpu(type) ((type *)(__alloc_percpu(sizeof(type))))
37 extern void setup_per_cpu_areas(void);
39 #endif /* _LWK_PERCPU_H */