[PATCH 09/48] kernel misc: Replace __get_cpu_var uses

From: Christoph Lameter
Date: Fri Feb 14 2014 - 15:32:29 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 2014-02-03 13:20:17.278906256 -0600
+++ linux/kernel/printk/printk.c 2014-02-03 13:20:17.278906256 -0600
@@ -2446,7 +2446,7 @@
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);
}

@@ -2464,7 +2464,7 @@
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();
}
@@ -2477,14 +2477,14 @@
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 2014-02-03 13:20:17.278906256 -0600
+++ linux/kernel/smp.c 2014-02-03 13:20:48.918248998 -0600
@@ -158,7 +158,7 @@
*/
WARN_ON_ONCE(!cpu_online(smp_processor_id()));

- entry = llist_del_all(&__get_cpu_var(call_single_queue));
+ entry = llist_del_all(this_cpu_ptr(&call_single_queue));
entry = llist_reverse_order(entry);

while (entry) {
@@ -218,7 +218,7 @@
struct call_single_data *csd = &d;

if (!wait)
- csd = &__get_cpu_var(csd_data);
+ csd = this_cpu_ptr(&csd_data);

csd_lock(csd);

@@ -366,7 +366,7 @@
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/