From: Ingo Molnar <mingo@elte.hu>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [patch] softirqs: fix latency of softirq processing
Date: Fri, 17 Sep 2004 14:17:45 +0200 [thread overview]
Message-ID: <20040917121745.GA1149@elte.hu> (raw)
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);
reply other threads:[~2004-09-17 12:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040917121745.GA1149@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®