You need to sign in or sign up before continuing.
提交 40dc11ff 编写于 作者: E Eric Dumazet 提交者: Ingo Molnar

printk: Use this_cpu_{read|write} api on printk_pending

__get_cpu_var() is a bit inefficient, lets use __this_cpu_read() and
__this_cpu_write() to manipulate printk_pending.

printk_needs_cpu(cpu) is called only for the current cpu :
Use faster __this_cpu_read().

Remove the redundant unlikely on (cpu_is_offline(cpu)) test:

 # size kernel/printk.o*
   text	   data	    bss	    dec	    hex	filename
   9942	    756	 263488	 274186	  42f0a	kernel/printk.o.new
   9990	    756	 263488	 274234	  42f3a	kernel/printk.o.old
Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Christoph Lameter <cl@linux.com>
Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1290788536.2855.237.camel@edumazet-laptop>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 806c09a7
...@@ -1074,17 +1074,17 @@ static DEFINE_PER_CPU(int, printk_pending); ...@@ -1074,17 +1074,17 @@ static DEFINE_PER_CPU(int, printk_pending);
void printk_tick(void) void printk_tick(void)
{ {
if (__get_cpu_var(printk_pending)) { if (__this_cpu_read(printk_pending)) {
__get_cpu_var(printk_pending) = 0; __this_cpu_write(printk_pending, 0);
wake_up_interruptible(&log_wait); wake_up_interruptible(&log_wait);
} }
} }
int printk_needs_cpu(int cpu) int printk_needs_cpu(int cpu)
{ {
if (unlikely(cpu_is_offline(cpu))) if (cpu_is_offline(cpu))
printk_tick(); printk_tick();
return per_cpu(printk_pending, cpu); return __this_cpu_read(printk_pending);
} }
void wake_up_klogd(void) void wake_up_klogd(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册