Commit e4e9bd23 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Try harder in IRQ context before falling back to ksoftirqd

From: "David S. Miller" <davem@redhat.com>

It's from Ingo Molnar.  ksoftirqd kicks in way too early, so do more work in
interrupt context before falling back.

We can probably sysctl this thing, that way everyone gets what they want
probably...

(has been in -mm since 2.5.71 and I haven't heard a peep).
parent b4aaf1ab
...@@ -57,11 +57,22 @@ static inline void wakeup_softirqd(void) ...@@ -57,11 +57,22 @@ static inline void wakeup_softirqd(void)
wake_up_process(tsk); wake_up_process(tsk);
} }
/*
* We restart softirq processing MAX_SOFTIRQ_RESTART times,
* and we fall back to softirqd after that.
*
* This number has been established via experimentation.
* The two things to balance is latency against fairness -
* we want to handle softirqs as soon as possible, but they
* should not be able to lock up the box.
*/
#define MAX_SOFTIRQ_RESTART 10
asmlinkage void do_softirq(void) asmlinkage void do_softirq(void)
{ {
int max_restart = MAX_SOFTIRQ_RESTART;
__u32 pending; __u32 pending;
unsigned long flags; unsigned long flags;
__u32 mask;
if (in_interrupt()) if (in_interrupt())
return; return;
...@@ -73,7 +84,6 @@ asmlinkage void do_softirq(void) ...@@ -73,7 +84,6 @@ asmlinkage void do_softirq(void)
if (pending) { if (pending) {
struct softirq_action *h; struct softirq_action *h;
mask = ~pending;
local_bh_disable(); local_bh_disable();
restart: restart:
/* Reset the pending bitmask before enabling irqs */ /* Reset the pending bitmask before enabling irqs */
...@@ -93,10 +103,8 @@ asmlinkage void do_softirq(void) ...@@ -93,10 +103,8 @@ asmlinkage void do_softirq(void)
local_irq_disable(); local_irq_disable();
pending = local_softirq_pending(); pending = local_softirq_pending();
if (pending & mask) { if (pending && --max_restart)
mask &= ~pending;
goto restart; goto restart;
}
if (pending) if (pending)
wakeup_softirqd(); wakeup_softirqd();
__local_bh_enable(); __local_bh_enable();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment