diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/softirq.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/kernel/softirq.c b/kernel/softirq.c index ed567babe789..47cb991c6ba4 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c | |||
@@ -195,21 +195,21 @@ void local_bh_enable_ip(unsigned long ip) | |||
195 | EXPORT_SYMBOL(local_bh_enable_ip); | 195 | EXPORT_SYMBOL(local_bh_enable_ip); |
196 | 196 | ||
197 | /* | 197 | /* |
198 | * We restart softirq processing MAX_SOFTIRQ_RESTART times, | 198 | * We restart softirq processing for at most 2 ms, |
199 | * and we fall back to softirqd after that. | 199 | * and if need_resched() is not set. |
200 | * | 200 | * |
201 | * This number has been established via experimentation. | 201 | * These limits have been established via experimentation. |
202 | * The two things to balance is latency against fairness - | 202 | * The two things to balance is latency against fairness - |
203 | * we want to handle softirqs as soon as possible, but they | 203 | * we want to handle softirqs as soon as possible, but they |
204 | * should not be able to lock up the box. | 204 | * should not be able to lock up the box. |
205 | */ | 205 | */ |
206 | #define MAX_SOFTIRQ_RESTART 10 | 206 | #define MAX_SOFTIRQ_TIME msecs_to_jiffies(2) |
207 | 207 | ||
208 | asmlinkage void __do_softirq(void) | 208 | asmlinkage void __do_softirq(void) |
209 | { | 209 | { |
210 | struct softirq_action *h; | 210 | struct softirq_action *h; |
211 | __u32 pending; | 211 | __u32 pending; |
212 | int max_restart = MAX_SOFTIRQ_RESTART; | 212 | unsigned long end = jiffies + MAX_SOFTIRQ_TIME; |
213 | int cpu; | 213 | int cpu; |
214 | unsigned long old_flags = current->flags; | 214 | unsigned long old_flags = current->flags; |
215 | 215 | ||
@@ -264,11 +264,12 @@ restart: | |||
264 | local_irq_disable(); | 264 | local_irq_disable(); |
265 | 265 | ||
266 | pending = local_softirq_pending(); | 266 | pending = local_softirq_pending(); |
267 | if (pending && --max_restart) | 267 | if (pending) { |
268 | goto restart; | 268 | if (time_before(jiffies, end) && !need_resched()) |
269 | goto restart; | ||
269 | 270 | ||
270 | if (pending) | ||
271 | wakeup_softirqd(); | 271 | wakeup_softirqd(); |
272 | } | ||
272 | 273 | ||
273 | lockdep_softirq_exit(); | 274 | lockdep_softirq_exit(); |
274 | 275 | ||