Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

percpu: update local_ops.txt to reflect this_cpu operations

Update the documentation to reflect changes due to the availability of
this_cpu operations.

Signed-off-by: Christoph Lameter <cl@linux.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Christoph Lameter and committed by
Linus Torvalds
7d94a82e 6c51ec4d

+9 -4
+9 -4
Documentation/local_ops.txt
··· 8 8 properly. It also stresses on the precautions that must be taken when reading 9 9 those local variables across CPUs when the order of memory writes matters. 10 10 11 + Note that local_t based operations are not recommended for general kernel use. 12 + Please use the this_cpu operations instead unless there is really a special purpose. 13 + Most uses of local_t in the kernel have been replaced by this_cpu operations. 14 + this_cpu operations combine the relocation with the local_t like semantics in 15 + a single instruction and yield more compact and faster executing code. 11 16 12 17 13 18 * Purpose of local atomic operations ··· 92 87 local_inc(&get_cpu_var(counters)); 93 88 put_cpu_var(counters); 94 89 95 - If you are already in a preemption-safe context, you can directly use 96 - __get_cpu_var() instead. 90 + If you are already in a preemption-safe context, you can use 91 + this_cpu_ptr() instead. 97 92 98 - local_inc(&__get_cpu_var(counters)); 93 + local_inc(this_cpu_ptr(&counters)); 99 94 100 95 101 96 ··· 139 134 { 140 135 /* Increment the counter from a non preemptible context */ 141 136 printk("Increment on cpu %d\n", smp_processor_id()); 142 - local_inc(&__get_cpu_var(counters)); 137 + local_inc(this_cpu_ptr(&counters)); 143 138 144 139 /* This is what incrementing the variable would look like within a 145 140 * preemptible context (it disables preemption) :