浏览代码

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>
Peter Zijlstra 15 年之前
父节点
当前提交
8b8e2ec1ee
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      include/linux/percpu.h

+ 9 - 0
include/linux/percpu.h

@@ -39,6 +39,15 @@
 	preempt_enable();				\
 	preempt_enable();				\
 } while (0)
 } 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
 #ifdef CONFIG_SMP
 
 
 /* minimum unit size, also is the maximum supported allocation size */
 /* minimum unit size, also is the maximum supported allocation size */