mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
percpu: Optimize __get_cpu_var()
Redefine __get_cpu_var() using this_cpu_ptr() which can be arch-optimized. Signed-off-by: Brian Gerst <brgerst@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
db7829c6cc
commit
677243d749
1 changed files with 3 additions and 4 deletions
|
@ -55,10 +55,6 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
|
|||
*/
|
||||
#define per_cpu(var, cpu) \
|
||||
(*SHIFT_PERCPU_PTR(&(var), per_cpu_offset(cpu)))
|
||||
#define __get_cpu_var(var) \
|
||||
(*SHIFT_PERCPU_PTR(&(var), my_cpu_offset))
|
||||
#define __raw_get_cpu_var(var) \
|
||||
(*SHIFT_PERCPU_PTR(&(var), __my_cpu_offset))
|
||||
|
||||
#ifndef __this_cpu_ptr
|
||||
#define __this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
|
||||
|
@ -69,6 +65,9 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
|
|||
#define this_cpu_ptr(ptr) __this_cpu_ptr(ptr)
|
||||
#endif
|
||||
|
||||
#define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
|
||||
#define __raw_get_cpu_var(var) (*__this_cpu_ptr(&(var)))
|
||||
|
||||
#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
|
||||
extern void setup_per_cpu_areas(void);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue