percpu: Consistent per cpu operations: The final edition
Subsystems (3)
cover percpu: Consistent per cpu operations: The final edition
This patchset removes the last leftovers of __get_cpu_var in the kernel. It updates the documentation and then removes the macros.
PATCH 1/4 Remove __get_cpu_var and __raw_get_cpu_var macros
No user is left in the kernel source tree. Therefore we can drop the definitions.
This is the final merge of the transition away from __get_cpu_var. After this patch the kernel will not build if anyone uses __get_cpu_var.
--- include/asm-generic/percpu.h | 5 ----- 1 file changed, 5 deletions(-)
include/linux/percpu-defs.h +0 -2
@@ -254,8 +254,6 @@ do { \#endif /* CONFIG_SMP */ #define per_cpu (var, cpu) (*per_cpu_ptr(&(var), cpu)) -#define __raw_get_cpu_var (var) (*raw_cpu_ptr(&(var))) -#define __get_cpu_var (var) (*this_cpu_ptr(&(var)))/* * Must be an lvalue. Since @var must be a simple identifier,
PATCH 4/4 parisc: Update comments refereing to __get_cpu_var
In reply to Christoph Lameter__get_cpu_var was removed. Update comments to refer to this_cpu_ptr() instead.
arch/parisc/lib/fixup.S +2 -2
@@ -38,14 +38,14 @@ LDREGX \t2(\t1),\t2 addil LT%exception_data,%r27 LDREG RT%exception_data(%r1),\t1 - /* t1 = &__get_cpu_var(exception_data) */ + /* t1 = this_cpu_ptr(&exception_data) */ add,l \t1,\t2,\t1 /* t1 = t1->fault_ip */ LDREG EXCDATA_IP(\t1), \t1 .endm #else .macro get_fault_ip t1 t2 - /* t1 = &__get_cpu_var(exception_data) */ + /* t1 = this_cpu_ptr(&exception_data) */ addil LT%exception_data,%r27 LDREG RT%exception_data(%r1),\t2 /* t1 = t2->fault_ip */
PATCH 3/4 ia64: Update comment that references __get_cpu_var
In reply to Christoph Lameter__get_cpu_var was removed. Update the comments.
arch/ia64/include/asm/percpu.h +2 -2
@@ -35,8 +35,8 @@ extern void *per_cpu_init(void);/* * Be extremely careful when taking the address of this variable! Due to virtual -* remapping, it is different from the canonical address returned by __get_cpu_var(var)! -* On the positive side, using __ia64_per_cpu_var() instead of __get_cpu_var() is slightly +* remapping, it is different from the canonical address returned by this_cpu_ptr(&var)! +* On the positive side, using __ia64_per_cpu_var() instead of this_cpu_ptr() is slightly * more efficient. */ #define __ia64_per_cpu_var (var) (*({ \
PATCH 2/4 Update local_ops.txt to reflect this_cpu operations
In reply to Christoph LameterUpdate the documentation to reflect changes due to the availability of this_cpu operations.
--- include/asm-generic/percpu.h | 5 ----- 1 file changed, 5 deletions(-)
Documentation/local_ops.txt +9 -4
@@ -8,6 +8,11 @@ to implement them for any given architec properly. It also stresses on the precautions that must be taken when reading those local variables across CPUs when the order of memory writes matters. +Note that local_t based operations are not recommended for general kernel use. +Please use the this_cpu operations instead unless there is really a special purpose. +Most uses of local_t in the kernel have been replaced by this_cpu operations. +this_cpu operations combine the relocation with the local_t like semantics in +a single instruction and yield more compact and faster executing code. * Purpose of local atomic operations
@@ -87,10 +92,10 @@ the per cpu variable. For instance : local_inc(&get_cpu_var(counters)); put_cpu_var(counters); -If you are already in a preemption-safe context, you can directly use -__get_cpu_var() instead. +If you are already in a preemption-safe context, you can use +this_cpu_ptr() instead. - local_inc(&__get_cpu_var(counters)); + local_inc(this_cpu_ptr(&counters));
@@ -134,7 +139,7 @@ static void test_each(void *info) { /* Increment the counter from a non preemptible context */ printk("Increment on cpu %d\n", smp_processor_id()); - local_inc(&__get_cpu_var(counters)); + local_inc(this_cpu_ptr(&counters)); /* This is what incrementing the variable would look like within a * preemptible context (it disables preemption) :