* [PATCH 0/4] percpu: Consistent per cpu operations: The final edition
@ 2014-12-02 21:24 Christoph Lameter
2014-12-02 21:24 ` [PATCH 1/4] Remove __get_cpu_var and __raw_get_cpu_var macros Christoph Lameter
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Christoph Lameter @ 2014-12-02 21:24 UTC (permalink / raw)
To: Tejun Heo; +Cc: akpm, linux-kernel
This patchset removes the last leftovers of __get_cpu_var in the kernel.
It updates the documentation and then removes the macros.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] Remove __get_cpu_var and __raw_get_cpu_var macros
2014-12-02 21:24 [PATCH 0/4] percpu: Consistent per cpu operations: The final edition Christoph Lameter
@ 2014-12-02 21:24 ` Christoph Lameter
2014-12-02 21:24 ` [PATCH 2/4] Update local_ops.txt to reflect this_cpu operations Christoph Lameter
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Christoph Lameter @ 2014-12-02 21:24 UTC (permalink / raw)
To: Tejun Heo; +Cc: akpm, linux-kernel
[-- Attachment #1: 0033-Remove-__get_cpu_var-and-__raw_get_cpu_var-macros-on.patch --]
[-- Type: text/plain, Size: 833 bytes --]
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.
Signed-off-by: Christoph Lameter <cl@linux.com>
---
include/asm-generic/percpu.h | 5 -----
1 file changed, 5 deletions(-)
Index: linux/include/linux/percpu-defs.h
===================================================================
--- linux.orig/include/linux/percpu-defs.h
+++ linux/include/linux/percpu-defs.h
@@ -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,
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/4] Update local_ops.txt to reflect this_cpu operations
2014-12-02 21:24 [PATCH 0/4] percpu: Consistent per cpu operations: The final edition Christoph Lameter
2014-12-02 21:24 ` [PATCH 1/4] Remove __get_cpu_var and __raw_get_cpu_var macros Christoph Lameter
@ 2014-12-02 21:24 ` Christoph Lameter
2014-12-02 21:24 ` [PATCH 3/4] ia64: Update comment that references __get_cpu_var Christoph Lameter
2014-12-02 21:24 ` [PATCH 4/4] parisc: Update comments refereing to __get_cpu_var Christoph Lameter
3 siblings, 0 replies; 5+ messages in thread
From: Christoph Lameter @ 2014-12-02 21:24 UTC (permalink / raw)
To: Tejun Heo; +Cc: akpm, linux-kernel
[-- Attachment #1: local_ops --]
[-- Type: text/plain, Size: 1825 bytes --]
Update the documentation to reflect changes due to the availability
of this_cpu operations.
Signed-off-by: Christoph Lameter <cl@linux.com>
---
include/asm-generic/percpu.h | 5 -----
1 file changed, 5 deletions(-)
Index: linux/Documentation/local_ops.txt
===================================================================
--- linux.orig/Documentation/local_ops.txt
+++ linux/Documentation/local_ops.txt
@@ -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) :
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] ia64: Update comment that references __get_cpu_var
2014-12-02 21:24 [PATCH 0/4] percpu: Consistent per cpu operations: The final edition Christoph Lameter
2014-12-02 21:24 ` [PATCH 1/4] Remove __get_cpu_var and __raw_get_cpu_var macros Christoph Lameter
2014-12-02 21:24 ` [PATCH 2/4] Update local_ops.txt to reflect this_cpu operations Christoph Lameter
@ 2014-12-02 21:24 ` Christoph Lameter
2014-12-02 21:24 ` [PATCH 4/4] parisc: Update comments refereing to __get_cpu_var Christoph Lameter
3 siblings, 0 replies; 5+ messages in thread
From: Christoph Lameter @ 2014-12-02 21:24 UTC (permalink / raw)
To: Tejun Heo; +Cc: akpm, linux-kernel, Tony Luck, Fenghua Yu
[-- Attachment #1: ia64_update --]
[-- Type: text/plain, Size: 944 bytes --]
__get_cpu_var was removed. Update the comments.
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Christoph Lameter <cl@linux.com>
Index: linux/arch/ia64/include/asm/percpu.h
===================================================================
--- linux.orig/arch/ia64/include/asm/percpu.h
+++ linux/arch/ia64/include/asm/percpu.h
@@ -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) (*({ \
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] parisc: Update comments refereing to __get_cpu_var
2014-12-02 21:24 [PATCH 0/4] percpu: Consistent per cpu operations: The final edition Christoph Lameter
` (2 preceding siblings ...)
2014-12-02 21:24 ` [PATCH 3/4] ia64: Update comment that references __get_cpu_var Christoph Lameter
@ 2014-12-02 21:24 ` Christoph Lameter
3 siblings, 0 replies; 5+ messages in thread
From: Christoph Lameter @ 2014-12-02 21:24 UTC (permalink / raw)
To: Tejun Heo; +Cc: akpm, linux-kernel, James E.J. Bottomley
[-- Attachment #1: parisc_update --]
[-- Type: text/plain, Size: 869 bytes --]
__get_cpu_var was removed. Update comments to refer to
this_cpu_ptr() instead.
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Signed-off-by: Christoph Lameter <cl@linux.com>
Index: linux/arch/parisc/lib/fixup.S
===================================================================
--- linux.orig/arch/parisc/lib/fixup.S
+++ linux/arch/parisc/lib/fixup.S
@@ -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 */
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-12-02 21:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-02 21:24 [PATCH 0/4] percpu: Consistent per cpu operations: The final edition Christoph Lameter
2014-12-02 21:24 ` [PATCH 1/4] Remove __get_cpu_var and __raw_get_cpu_var macros Christoph Lameter
2014-12-02 21:24 ` [PATCH 2/4] Update local_ops.txt to reflect this_cpu operations Christoph Lameter
2014-12-02 21:24 ` [PATCH 3/4] ia64: Update comment that references __get_cpu_var Christoph Lameter
2014-12-02 21:24 ` [PATCH 4/4] parisc: Update comments refereing to __get_cpu_var Christoph Lameter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox