aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 20:37:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 20:37:47 -0400
commitf5c101892fbd3d2f6d2729bc7eb7b3f6c31dbddd (patch)
treeae24f42e327c95af356cfa5ba407b1a7fad84fd5 /include
parentc54894cd4672d513e43e0d17d7b0387bf6b2c2c4 (diff)
parent641b695c2f11397bd307ea689d4d3f128360ce49 (diff)
Merge branch 'for-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
Pull percpu updates from Tejun Heo: "Contains Alex Shi's three patches to remove percpu_xxx() which overlap with this_cpu_xxx(). There shouldn't be any functional change." * 'for-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: percpu: remove percpu_xxx() functions x86: replace percpu_xxx funcs with this_cpu_xxx net: replace percpu_xxx funcs with this_cpu_xxx or __this_cpu_xxx
Diffstat (limited to 'include')
-rw-r--r--include/linux/percpu.h54
-rw-r--r--include/linux/topology.h4
2 files changed, 2 insertions, 56 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 21638ae14e07..2b9f82c037c9 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -166,60 +166,6 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
166 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) 166 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type))
167 167
168/* 168/*
169 * Optional methods for optimized non-lvalue per-cpu variable access.
170 *
171 * @var can be a percpu variable or a field of it and its size should
172 * equal char, int or long. percpu_read() evaluates to a lvalue and
173 * all others to void.
174 *
175 * These operations are guaranteed to be atomic.
176 * The generic versions disable interrupts. Archs are
177 * encouraged to implement single-instruction alternatives which don't
178 * require protection.
179 */
180#ifndef percpu_read
181# define percpu_read(var) \
182 ({ \
183 typeof(var) *pr_ptr__ = &(var); \
184 typeof(var) pr_ret__; \
185 pr_ret__ = get_cpu_var(*pr_ptr__); \
186 put_cpu_var(*pr_ptr__); \
187 pr_ret__; \
188 })
189#endif
190
191#define __percpu_generic_to_op(var, val, op) \
192do { \
193 typeof(var) *pgto_ptr__ = &(var); \
194 get_cpu_var(*pgto_ptr__) op val; \
195 put_cpu_var(*pgto_ptr__); \
196} while (0)
197
198#ifndef percpu_write
199# define percpu_write(var, val) __percpu_generic_to_op(var, (val), =)
200#endif
201
202#ifndef percpu_add
203# define percpu_add(var, val) __percpu_generic_to_op(var, (val), +=)
204#endif
205
206#ifndef percpu_sub
207# define percpu_sub(var, val) __percpu_generic_to_op(var, (val), -=)
208#endif
209
210#ifndef percpu_and
211# define percpu_and(var, val) __percpu_generic_to_op(var, (val), &=)
212#endif
213
214#ifndef percpu_or
215# define percpu_or(var, val) __percpu_generic_to_op(var, (val), |=)
216#endif
217
218#ifndef percpu_xor
219# define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=)
220#endif
221
222/*
223 * Branching function to split up a function into a set of functions that 169 * Branching function to split up a function into a set of functions that
224 * are called for different scalar sizes of the objects handled. 170 * are called for different scalar sizes of the objects handled.
225 */ 171 */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index e26db031303b..9dc427cdb6ff 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -239,7 +239,7 @@ static inline int cpu_to_node(int cpu)
239#ifndef set_numa_node 239#ifndef set_numa_node
240static inline void set_numa_node(int node) 240static inline void set_numa_node(int node)
241{ 241{
242 percpu_write(numa_node, node); 242 this_cpu_write(numa_node, node);
243} 243}
244#endif 244#endif
245 245
@@ -274,7 +274,7 @@ DECLARE_PER_CPU(int, _numa_mem_);
274#ifndef set_numa_mem 274#ifndef set_numa_mem
275static inline void set_numa_mem(int node) 275static inline void set_numa_mem(int node)
276{ 276{
277 percpu_write(_numa_mem_, node); 277 this_cpu_write(_numa_mem_, node);
278} 278}
279#endif 279#endif
280 280