Re: [PATCH] serial8250: ratelimit "too much work" error

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Morton
Date: Monday, October 4, 2010 - 2:51 pm

On Sat,  2 Oct 2010 12:04:38 +0100 (BST)
Daniel Drake <dsd@laptop.org> wrote:


printk_ratelimit() shares a common ratelimiting state between all
callers of printk_ratelimit().  This is pretty sucky because if one
printk_ratelimit() caller is going crazy then this can cause punishment
of other unrelated printk_ratelimit() callers who *aren't* going crazy.

So it's generally better to use printk_ratelimited(), which will
ratelimit this printkand no other printk, without affecting other
printk_ratelimit[ed]() users.

So, this:

--- a/drivers/serial/8250.c~serial8250-ratelimit-too-much-work-error-fix
+++ a/drivers/serial/8250.c
@@ -1606,9 +1606,8 @@ static irqreturn_t serial8250_interrupt(
 
 		if (l == i->head && pass_counter++ > PASS_LIMIT) {
 			/* If we hit this, we're dead. */
-			if (printk_ratelimit())
-				printk(KERN_ERR "serial8250: too much work for "
-					"irq%d\n", irq);
+			printk_ratelimited(KERN_ERR
+				"serial8250: too much work for irq%d\n", irq);
 			break;
 		}
 	} while (l != end);
_

which, interestingly, doesn't compile because someone stuck a
DEFINE_RATELIMIT_STATE() in include/linux/kernel.h and it ain't defined
anywhere.  Let me fix that up...

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] serial8250: ratelimit "too much work" error, Andrew Morton, (Mon Oct 4, 2:51 pm)