diff options
author | Dave Young <hidave.darkstar@gmail.com> | 2008-07-25 04:45:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:29 -0400 |
commit | 717115e1a5856b57af0f71e1df7149108294fc10 (patch) | |
tree | 9528a992245c2fb993a0cf0bc8221dc7dea5d259 /include/linux/rcupreempt.h | |
parent | 2711b793eb62a5873a0ba583a69252040aef176e (diff) |
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>
Diffstat (limited to 'include/linux/rcupreempt.h')
-rw-r--r-- | include/linux/rcupreempt.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h index f04b64eca636..0967f03b0705 100644 --- a/include/linux/rcupreempt.h +++ b/include/linux/rcupreempt.h | |||
@@ -115,16 +115,21 @@ DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched); | |||
115 | 115 | ||
116 | static inline void rcu_enter_nohz(void) | 116 | static inline void rcu_enter_nohz(void) |
117 | { | 117 | { |
118 | static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1); | ||
119 | |||
118 | smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */ | 120 | smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */ |
119 | __get_cpu_var(rcu_dyntick_sched).dynticks++; | 121 | __get_cpu_var(rcu_dyntick_sched).dynticks++; |
120 | WARN_ON(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1); | 122 | WARN_ON_RATELIMIT(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1, &rs); |
121 | } | 123 | } |
122 | 124 | ||
123 | static inline void rcu_exit_nohz(void) | 125 | static inline void rcu_exit_nohz(void) |
124 | { | 126 | { |
127 | static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1); | ||
128 | |||
125 | smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */ | 129 | smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */ |
126 | __get_cpu_var(rcu_dyntick_sched).dynticks++; | 130 | __get_cpu_var(rcu_dyntick_sched).dynticks++; |
127 | WARN_ON(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1)); | 131 | WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1), |
132 | &rs); | ||
128 | } | 133 | } |
129 | 134 | ||
130 | #else /* CONFIG_NO_HZ */ | 135 | #else /* CONFIG_NO_HZ */ |