[PATCH 04/40] kernel misc: Replace __get_cpu_var uses
From: Christoph Lameter
Date: Thu Dec 19 2013 - 11:13:57 EST
Replace uses of __get_cpu_var for address calculation with this_cpu_ptr.
Cc: akpm@xxxxxxxxxxxxxxxxxxxx
Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>
Index: linux/kernel/printk/printk.c
===================================================================
--- linux.orig/kernel/printk/printk.c 2013-12-02 16:07:47.434699125 -0600
+++ linux/kernel/printk/printk.c 2013-12-02 16:07:47.434699125 -0600
@@ -2447,7 +2447,7 @@ static void wake_up_klogd_work_func(stru
int pending = __this_cpu_xchg(printk_pending, 0);
if (pending & PRINTK_PENDING_SCHED) {
- char *buf = __get_cpu_var(printk_sched_buf);
+ char *buf = this_cpu_ptr(printk_sched_buf);
pr_warn("[sched_delayed] %s", buf);
}
@@ -2465,7 +2465,7 @@ void wake_up_klogd(void)
preempt_disable();
if (waitqueue_active(&log_wait)) {
this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP);
- irq_work_queue(&__get_cpu_var(wake_up_klogd_work));
+ irq_work_queue(this_cpu_ptr(&wake_up_klogd_work));
}
preempt_enable();
}
@@ -2478,14 +2478,14 @@ int printk_sched(const char *fmt, ...)
int r;
local_irq_save(flags);
- buf = __get_cpu_var(printk_sched_buf);
+ buf = this_cpu_ptr(printk_sched_buf);
va_start(args, fmt);
r = vsnprintf(buf, PRINTK_BUF_SIZE, fmt, args);
va_end(args);
__this_cpu_or(printk_pending, PRINTK_PENDING_SCHED);
- irq_work_queue(&__get_cpu_var(wake_up_klogd_work));
+ irq_work_queue(this_cpu_ptr(&wake_up_klogd_work));
local_irq_restore(flags);
return r;
Index: linux/kernel/smp.c
===================================================================
--- linux.orig/kernel/smp.c 2013-12-02 16:07:47.434699125 -0600
+++ linux/kernel/smp.c 2013-12-02 16:07:47.434699125 -0600
@@ -177,7 +177,7 @@ static void generic_exec_single(int cpu,
*/
void generic_smp_call_function_single_interrupt(void)
{
- struct call_single_queue *q = &__get_cpu_var(call_single_queue);
+ struct call_single_queue *q = this_cpu_ptr(&call_single_queue);
LIST_HEAD(list);
/*
@@ -245,7 +245,7 @@ int smp_call_function_single(int cpu, sm
struct call_single_data *csd = &d;
if (!wait)
- csd = &__get_cpu_var(csd_data);
+ csd = this_cpu_ptr(&csd_data);
csd_lock(csd);
@@ -393,7 +393,7 @@ void smp_call_function_many(const struct
return;
}
- cfd = &__get_cpu_var(cfd_data);
+ cfd = this_cpu_ptr(&cfd_data);
cpumask_and(cfd->cpumask, mask, cpu_online_mask);
cpumask_clear_cpu(this_cpu, cfd->cpumask);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/