mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 07:01:23 +00:00
printk ratelimiting rewrite
All ratelimit user use same jiffies and burst params, so some messages (callbacks) will be lost. For example: a call printk_ratelimit(5 * HZ, 1) b call printk_ratelimit(5 * HZ, 1) before the 5*HZ timeout of a, then b will will be supressed. - rewrite __ratelimit, and use a ratelimit_state as parameter. Thanks for hints from andrew. - Add WARN_ON_RATELIMIT, update rcupreempt.h - remove __printk_ratelimit - use __ratelimit in net_ratelimit Signed-off-by: Dave Young <hidave.darkstar@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: "Paul E. McKenney" <paulmck@us.ibm.com> Cc: Dave Young <hidave.darkstar@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
2711b793eb
commit
717115e1a5
10 changed files with 79 additions and 56 deletions
|
@ -31,17 +31,16 @@
|
|||
#include <asm/system.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
int net_msg_cost __read_mostly = 5*HZ;
|
||||
int net_msg_burst __read_mostly = 10;
|
||||
int net_msg_warn __read_mostly = 1;
|
||||
EXPORT_SYMBOL(net_msg_warn);
|
||||
|
||||
DEFINE_RATELIMIT_STATE(net_ratelimit_state, 5 * HZ, 10);
|
||||
/*
|
||||
* All net warning printk()s should be guarded by this function.
|
||||
*/
|
||||
int net_ratelimit(void)
|
||||
{
|
||||
return __printk_ratelimit(net_msg_cost, net_msg_burst);
|
||||
return __ratelimit(&net_ratelimit_state);
|
||||
}
|
||||
EXPORT_SYMBOL(net_ratelimit);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue