]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
percpu: Add {get,put}_cpu_ptr
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Thu, 16 Sep 2010 17:21:28 +0000 (19:21 +0200)
committerIngo Molnar <mingo@elte.hu>
Tue, 21 Sep 2010 11:55:43 +0000 (13:55 +0200)
These are similar to {get,put}_cpu_var() except for dynamically
allocated per-cpu memory.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Tejun Heo <tj@kernel.org>
LKML-Reference: <20100917093009.252867712@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/percpu.h

index 49466b13c5c6b310f36b31c052573864df6f02a0..0eb50832aa00fd1bbc31cc23837abfc698412402 100644 (file)
        preempt_enable();                               \
 } while (0)
 
+#define get_cpu_ptr(var) ({                            \
+       preempt_disable();                              \
+       this_cpu_ptr(var); })
+
+#define put_cpu_ptr(var) do {                          \
+       (void)(var);                                    \
+       preempt_enable();                               \
+} while (0)
+
 #ifdef CONFIG_SMP
 
 /* minimum unit size, also is the maximum supported allocation size */