[PATCH 1/6] percpu: {get,put}_cpu_ptr

From: Peter Zijlstra
Date: Fri Sep 17 2010 - 05:34:15 EST


Similar to {get,put}_cpu_var() except for dynamically allocated per-cpu memory.

Cc: Tejun Heo <tj@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
---
include/linux/percpu.h | 9 +++++++++
1 file changed, 9 insertions(+)

Index: linux-2.6/include/linux/percpu.h
===================================================================
--- linux-2.6.orig/include/linux/percpu.h
+++ linux-2.6/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 */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/