aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
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 /include/linux
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 'include/linux')
-rw-r--r--include/linux/kernel.h3
-rw-r--r--include/linux/ratelimit.h3
2 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 3305f33201b..21d0d822c71 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -240,7 +240,8 @@ asmlinkage int vprintk(const char *fmt, va_list args)
240asmlinkage int printk(const char * fmt, ...) 240asmlinkage int printk(const char * fmt, ...)
241 __attribute__ ((format (printf, 1, 2))) __cold; 241 __attribute__ ((format (printf, 1, 2))) __cold;
242 242
243extern int printk_ratelimit(void); 243extern int __printk_ratelimit(const char *func);
244#define printk_ratelimit() __printk_ratelimit(__func__)
244extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, 245extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
245 unsigned int interval_msec); 246 unsigned int interval_msec);
246 247
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index 187bc16c1f1..668cf1bef03 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -25,6 +25,7 @@ struct ratelimit_state {
25 .burst = burst_init, \ 25 .burst = burst_init, \
26 } 26 }
27 27
28extern int __ratelimit(struct ratelimit_state *rs); 28extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
29#define __ratelimit(state) ___ratelimit(state, __func__)
29 30
30#endif /* _LINUX_RATELIMIT_H */ 31#endif /* _LINUX_RATELIMIT_H */