aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2009-10-23 08:58:11 -0400
committerIngo Molnar <mingo@elte.hu>2009-10-23 11:26:37 -0400
commit5c828713358cb9df8aa174371edcbbb62203a490 (patch)
treec8aeafba911cb428b5dc46a9e252c337b7c51d17 /lib
parent3fff4c42bd0a89869a0eb1e7874cc06ffa4aa0f5 (diff)
ratelimit: Make suppressed output messages more useful
Today I got: [39648.224782] Registered led device: iwl-phy0::TX [40676.545099] __ratelimit: 246 callbacks suppressed [40676.545103] abcdef[23675]: segfault at 0 ... as you can see the ratelimit message contains a function prefix. Since this is always __ratelimit, this wont help much. This patch changes __ratelimit and printk_ratelimit to print the function name that calls ratelimit. This will pinpoint the responsible function, as long as not several different places call ratelimit with the same ratelimit state at the same time. In that case we catch only one random function that calls ratelimit after the wait period. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Dave Young <hidave.darkstar@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> CC: Andrew Morton <akpm@linux-foundation.org> LKML-Reference: <200910231458.11832.borntraeger@de.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'lib')
-rw-r--r--lib/ratelimit.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ratelimit.c b/lib/ratelimit.c
index 5551731ae1d4..09f5ce1810dc 100644
--- a/lib/ratelimit.c
+++ b/lib/ratelimit.c
@@ -20,7 +20,7 @@
20 * This enforces a rate limit: not more than @rs->ratelimit_burst callbacks 20 * This enforces a rate limit: not more than @rs->ratelimit_burst callbacks
21 * in every @rs->ratelimit_jiffies 21 * in every @rs->ratelimit_jiffies
22 */ 22 */
23int __ratelimit(struct ratelimit_state *rs) 23int ___ratelimit(struct ratelimit_state *rs, const char *func)
24{ 24{
25 unsigned long flags; 25 unsigned long flags;
26 int ret; 26 int ret;
@@ -43,7 +43,7 @@ int __ratelimit(struct ratelimit_state *rs)
43 if (time_is_before_jiffies(rs->begin + rs->interval)) { 43 if (time_is_before_jiffies(rs->begin + rs->interval)) {
44 if (rs->missed) 44 if (rs->missed)
45 printk(KERN_WARNING "%s: %d callbacks suppressed\n", 45 printk(KERN_WARNING "%s: %d callbacks suppressed\n",
46 __func__, rs->missed); 46 func, rs->missed);
47 rs->begin = 0; 47 rs->begin = 0;
48 rs->printed = 0; 48 rs->printed = 0;
49 rs->missed = 0; 49 rs->missed = 0;
@@ -59,4 +59,4 @@ int __ratelimit(struct ratelimit_state *rs)
59 59
60 return ret; 60 return ret;
61} 61}
62EXPORT_SYMBOL(__ratelimit); 62EXPORT_SYMBOL(___ratelimit);