summaryrefslogtreecommitdiff
path: root/include/linux/percpu.h
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-09-16 21:21:28 +0400
committerIngo Molnar <mingo@elte.hu>2010-09-21 15:55:43 +0400
commit8b8e2ec1eeca7f6941bc81cefc9663018d6ceb57 (patch)
treefbbfa0732aceb7204f1f962e004ea192e7b7d833 /include/linux/percpu.h
parent7ed569206ebe7467b9c912b857ec46cf1c361111 (diff)
downloadlinux-8b8e2ec1eeca7f6941bc81cefc9663018d6ceb57.tar.xz
percpu: Add {get,put}_cpu_ptr
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>
Diffstat (limited to 'include/linux/percpu.h')
-rw-r--r--include/linux/percpu.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 49466b13c5c6..0eb50832aa00 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -39,6 +39,15 @@
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 */