diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-10-29 09:34:15 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-10-29 09:34:15 -0400 |
commit | dd17c8f72993f9461e9c19250e3f155d6d99df22 (patch) | |
tree | c33eedf0cf2862e9feeb796e94d49a2ccdce0149 /include | |
parent | 390dfd95c5df1ab3921dd388d11b2aee332c3f2c (diff) |
percpu: remove per_cpu__ prefix.
Now that the return from alloc_percpu is compatible with the address
of per-cpu vars, it makes sense to hand around the address of per-cpu
variables. To make this sane, we remove the per_cpu__ prefix we used
created to stop people accidentally using these vars directly.
Now we have sparse, we can use that (next patch).
tj: * Updated to convert stuff which were missed by or added after the
original patch.
* Kill per_cpu_var() macro.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Christoph Lameter <cl@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/percpu.h | 12 | ||||
-rw-r--r-- | include/linux/percpu-defs.h | 18 | ||||
-rw-r--r-- | include/linux/percpu.h | 5 | ||||
-rw-r--r-- | include/linux/vmstat.h | 8 |
4 files changed, 18 insertions, 25 deletions
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index 8087b90d4673..ca6f0491412b 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h | |||
@@ -50,11 +50,11 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; | |||
50 | * offset. | 50 | * offset. |
51 | */ | 51 | */ |
52 | #define per_cpu(var, cpu) \ | 52 | #define per_cpu(var, cpu) \ |
53 | (*SHIFT_PERCPU_PTR(&per_cpu_var(var), per_cpu_offset(cpu))) | 53 | (*SHIFT_PERCPU_PTR(&(var), per_cpu_offset(cpu))) |
54 | #define __get_cpu_var(var) \ | 54 | #define __get_cpu_var(var) \ |
55 | (*SHIFT_PERCPU_PTR(&per_cpu_var(var), my_cpu_offset)) | 55 | (*SHIFT_PERCPU_PTR(&(var), my_cpu_offset)) |
56 | #define __raw_get_cpu_var(var) \ | 56 | #define __raw_get_cpu_var(var) \ |
57 | (*SHIFT_PERCPU_PTR(&per_cpu_var(var), __my_cpu_offset)) | 57 | (*SHIFT_PERCPU_PTR(&(var), __my_cpu_offset)) |
58 | 58 | ||
59 | #define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset) | 59 | #define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset) |
60 | #define __this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset) | 60 | #define __this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset) |
@@ -66,9 +66,9 @@ extern void setup_per_cpu_areas(void); | |||
66 | 66 | ||
67 | #else /* ! SMP */ | 67 | #else /* ! SMP */ |
68 | 68 | ||
69 | #define per_cpu(var, cpu) (*((void)(cpu), &per_cpu_var(var))) | 69 | #define per_cpu(var, cpu) (*((void)(cpu), &(var))) |
70 | #define __get_cpu_var(var) per_cpu_var(var) | 70 | #define __get_cpu_var(var) (var) |
71 | #define __raw_get_cpu_var(var) per_cpu_var(var) | 71 | #define __raw_get_cpu_var(var) (var) |
72 | #define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) | 72 | #define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) |
73 | #define __this_cpu_ptr(ptr) this_cpu_ptr(ptr) | 73 | #define __this_cpu_ptr(ptr) this_cpu_ptr(ptr) |
74 | 74 | ||
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index 5a5d6ce4bd55..ee99f6c2cdcd 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h | |||
@@ -2,12 +2,6 @@ | |||
2 | #define _LINUX_PERCPU_DEFS_H | 2 | #define _LINUX_PERCPU_DEFS_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * Determine the real variable name from the name visible in the | ||
6 | * kernel sources. | ||
7 | */ | ||
8 | #define per_cpu_var(var) per_cpu__##var | ||
9 | |||
10 | /* | ||
11 | * Base implementations of per-CPU variable declarations and definitions, where | 5 | * Base implementations of per-CPU variable declarations and definitions, where |
12 | * the section in which the variable is to be placed is provided by the | 6 | * the section in which the variable is to be placed is provided by the |
13 | * 'sec' argument. This may be used to affect the parameters governing the | 7 | * 'sec' argument. This may be used to affect the parameters governing the |
@@ -56,24 +50,24 @@ | |||
56 | */ | 50 | */ |
57 | #define DECLARE_PER_CPU_SECTION(type, name, sec) \ | 51 | #define DECLARE_PER_CPU_SECTION(type, name, sec) \ |
58 | extern __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ | 52 | extern __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ |
59 | extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name | 53 | extern __PCPU_ATTRS(sec) __typeof__(type) name |
60 | 54 | ||
61 | #define DEFINE_PER_CPU_SECTION(type, name, sec) \ | 55 | #define DEFINE_PER_CPU_SECTION(type, name, sec) \ |
62 | __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ | 56 | __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ |
63 | extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ | 57 | extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ |
64 | __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ | 58 | __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ |
65 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \ | 59 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \ |
66 | __typeof__(type) per_cpu__##name | 60 | __typeof__(type) name |
67 | #else | 61 | #else |
68 | /* | 62 | /* |
69 | * Normal declaration and definition macros. | 63 | * Normal declaration and definition macros. |
70 | */ | 64 | */ |
71 | #define DECLARE_PER_CPU_SECTION(type, name, sec) \ | 65 | #define DECLARE_PER_CPU_SECTION(type, name, sec) \ |
72 | extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name | 66 | extern __PCPU_ATTRS(sec) __typeof__(type) name |
73 | 67 | ||
74 | #define DEFINE_PER_CPU_SECTION(type, name, sec) \ | 68 | #define DEFINE_PER_CPU_SECTION(type, name, sec) \ |
75 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES \ | 69 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES \ |
76 | __typeof__(type) per_cpu__##name | 70 | __typeof__(type) name |
77 | #endif | 71 | #endif |
78 | 72 | ||
79 | /* | 73 | /* |
@@ -137,8 +131,8 @@ | |||
137 | /* | 131 | /* |
138 | * Intermodule exports for per-CPU variables. | 132 | * Intermodule exports for per-CPU variables. |
139 | */ | 133 | */ |
140 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) | 134 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(var) |
141 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) | 135 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(var) |
142 | 136 | ||
143 | 137 | ||
144 | #endif /* _LINUX_PERCPU_DEFS_H */ | 138 | #endif /* _LINUX_PERCPU_DEFS_H */ |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 522f421ec213..e12410e55e05 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -182,7 +182,7 @@ static inline void *pcpu_lpage_remapped(void *kaddr) | |||
182 | #ifndef percpu_read | 182 | #ifndef percpu_read |
183 | # define percpu_read(var) \ | 183 | # define percpu_read(var) \ |
184 | ({ \ | 184 | ({ \ |
185 | typeof(per_cpu_var(var)) __tmp_var__; \ | 185 | typeof(var) __tmp_var__; \ |
186 | __tmp_var__ = get_cpu_var(var); \ | 186 | __tmp_var__ = get_cpu_var(var); \ |
187 | put_cpu_var(var); \ | 187 | put_cpu_var(var); \ |
188 | __tmp_var__; \ | 188 | __tmp_var__; \ |
@@ -253,8 +253,7 @@ do { \ | |||
253 | 253 | ||
254 | /* | 254 | /* |
255 | * Optimized manipulation for memory allocated through the per cpu | 255 | * Optimized manipulation for memory allocated through the per cpu |
256 | * allocator or for addresses of per cpu variables (can be determined | 256 | * allocator or for addresses of per cpu variables. |
257 | * using per_cpu_var(xx). | ||
258 | * | 257 | * |
259 | * These operation guarantee exclusivity of access for other operations | 258 | * These operation guarantee exclusivity of access for other operations |
260 | * on the *same* processor. The assumption is that per cpu data is only | 259 | * on the *same* processor. The assumption is that per cpu data is only |
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index d85889710f9b..3e489fda11a1 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
@@ -76,22 +76,22 @@ DECLARE_PER_CPU(struct vm_event_state, vm_event_states); | |||
76 | 76 | ||
77 | static inline void __count_vm_event(enum vm_event_item item) | 77 | static inline void __count_vm_event(enum vm_event_item item) |
78 | { | 78 | { |
79 | __this_cpu_inc(per_cpu_var(vm_event_states).event[item]); | 79 | __this_cpu_inc(vm_event_states.event[item]); |
80 | } | 80 | } |
81 | 81 | ||
82 | static inline void count_vm_event(enum vm_event_item item) | 82 | static inline void count_vm_event(enum vm_event_item item) |
83 | { | 83 | { |
84 | this_cpu_inc(per_cpu_var(vm_event_states).event[item]); | 84 | this_cpu_inc(vm_event_states.event[item]); |
85 | } | 85 | } |
86 | 86 | ||
87 | static inline void __count_vm_events(enum vm_event_item item, long delta) | 87 | static inline void __count_vm_events(enum vm_event_item item, long delta) |
88 | { | 88 | { |
89 | __this_cpu_add(per_cpu_var(vm_event_states).event[item], delta); | 89 | __this_cpu_add(vm_event_states.event[item], delta); |
90 | } | 90 | } |
91 | 91 | ||
92 | static inline void count_vm_events(enum vm_event_item item, long delta) | 92 | static inline void count_vm_events(enum vm_event_item item, long delta) |
93 | { | 93 | { |
94 | this_cpu_add(per_cpu_var(vm_event_states).event[item], delta); | 94 | this_cpu_add(vm_event_states.event[item], delta); |
95 | } | 95 | } |
96 | 96 | ||
97 | extern void all_vm_events(unsigned long *); | 97 | extern void all_vm_events(unsigned long *); |