lkml.org 
[lkml]   [2010]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.




\
 
 \ /
  Last update: 2010-11-26 17:43    [W:0.060 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site