* [patch] softirqs: fix latency of softirq processing
@ 2004-09-17 12:17 Ingo Molnar
0 siblings, 0 replies; only message in thread
From: Ingo Molnar @ 2004-09-17 12:17 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
the attached patch fixes a local_bh_enable() buglet: we first enabled
softirqs then did we do local_softirq_pending() - often this is
preemptible code. So this task could be preempted and there's no
guarantee that softirq processing will occur (except the periodic timer
tick).
the race window is small but existent. This could result in packet
processing latencies or timer expiration latencies - hard to detect and
annoying bugs.
the fix is to invoke softirqs with softirqs enabled but preemption still
disabled. Patch is against 2.6.9-rc2-mm1.
Ingo
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--- linux/kernel/softirq.c.orig
+++ linux/kernel/softirq.c
@@ -137,12 +137,19 @@ EXPORT_SYMBOL(do_softirq);
void local_bh_enable(void)
{
- __local_bh_enable();
WARN_ON(irqs_disabled());
- if (unlikely(!in_interrupt() &&
- local_softirq_pending()))
+ if (unlikely(!in_interrupt() && local_softirq_pending())) {
+ /*
+ * Keep preemption disabled until we are done with
+ * softirq processing:
+ */
+ preempt_count() -= SOFTIRQ_OFFSET - 1;
invoke_softirq();
- preempt_check_resched();
+ preempt_enable();
+ } else {
+ __local_bh_enable();
+ preempt_check_resched();
+ }
}
EXPORT_SYMBOL(local_bh_enable);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-09-17 12:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-17 12:17 [patch] softirqs: fix latency of softirq processing Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®