Messages in this thread | | | Date | Fri, 26 Nov 2010 10:40:53 -0600 (CST) | From | Christoph Lameter <> | Subject | Re: [PATCH] printk: use this_cpu_{read|write} api on printk_pending |
| |
On Fri, 26 Nov 2010, Eric Dumazet wrote:
> --- a/kernel/printk.c > +++ b/kernel/printk.c > @@ -1074,17 +1074,17 @@ static DEFINE_PER_CPU(int, printk_pending); > > void printk_tick(void) > { > - if (__get_cpu_var(printk_pending)) { > - __get_cpu_var(printk_pending) = 0; > + if (__this_cpu_read(printk_pending)) { > + __this_cpu_write(printk_pending, 0); > wake_up_interruptible(&log_wait); > } > }
The above looks ok.
> int printk_needs_cpu(int cpu) > { > - if (unlikely(cpu_is_offline(cpu))) > + if (cpu_is_offline(cpu)) > printk_tick(); > - return per_cpu(printk_pending, cpu); > + return __this_cpu_read(printk_pending); > }
This only works if printk_needs_cpu is always passed the current cpu. The check for cpu_is_offline suggests that the function is also used for other cpus. The __this_cpu_read() will then get the printk_pending stat for the current cpu and not for the specified cpu.
| |