[PATCH] printk: do not flush the logbuf into console driver ininterrupt

From: Liu, Chuansheng
Date: Thu May 17 2012 - 03:46:35 EST


From: liu chuansheng <chuansheng.liu@xxxxxxxxx>
Subject: [PATCH] printk: do not flush the logbuf into console driver in interrupt

When irq handle tried to call printk, and it also has the chance to obtain the console sem,
then flush the log buf to console driver,but the console driver often give several ms latency
or more when much data in log buf existed, it will delay the irq handle.

The solution is when calling the printk in interrupt, just write the chars into log buf,
and expect other threads to flush it into console driver.

Signed-off-by: liu chuansheng <chuansheng.liu@xxxxxxxxx>

diff --git a/kernel/printk.c b/kernel/printk.c index b663c2c..99959e1 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -804,7 +804,8 @@ static int console_trylock_for_printk(unsigned int cpu)
* the buffer. We need to hold the console semaphore
* in order to do this test safely.
*/
- if (!can_use_console(cpu)) {
+ if (!can_use_console(cpu) ||
+ (in_interrupt() && (!oops_in_progress))) {
console_locked = 0;
wake = 1;
retval = 0;
--
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/