Commit 849ac1ba authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Thomas Gleixner

cpu-hotplug: get_cpu_var_locked online aware

Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 15868172
......@@ -43,14 +43,36 @@
* are the same as the normal per-CPU variables, so there no
* runtime overhead.
*/
#ifdef CONFIG_PREEMPT_RT
#define get_cpu_var_locked(var, cpuptr) \
(*({ \
int __cpu = raw_smp_processor_id(); \
spinlock_t *__lock; \
int __cpu; \
\
again: \
__cpu = raw_smp_processor_id(); \
__lock = &__get_cpu_lock(var, __cpu); \
spin_lock(__lock); \
if (!cpu_online(__cpu)) { \
spin_unlock(__lock); \
goto again; \
} \
*(cpuptr) = __cpu; \
&__get_cpu_var_locked(var, __cpu); \
}))
#else
#define get_cpu_var_locked(var, cpuptr) \
(*({ \
int __cpu; \
\
preempt_disable(); \
__cpu = smp_processor_id(); \
spin_lock(&__get_cpu_lock(var, __cpu)); \
preempt_enable(); \
*(cpuptr) = __cpu; \
&__get_cpu_var_locked(var, __cpu); \
}))
#endif
#define put_cpu_var_locked(var, cpu) \
do { (void)cpu; spin_unlock(&__get_cpu_lock(var, cpu)); } while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment