[patch] softirq-2.4.5-B0

Ingo Molnar (mingo@elte.hu)
Sun, 27 May 2001 21:00:35 +0200 (CEST)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

--8323328-739968658-990990035=:5852
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Sat, 26 May 2001, David S. Miller wrote:

> And looking at the x86 code, I don't even understand how your fixes
> can make a difference, what about the do_softirq() call in
> arch/i386/kernel/irq.c:do_IRQ()??? [...]

[you are right, it's a brain fart on my part. doh. i guess i was too happy
having fixed the longstanding latency problem.]

the TCP latency issues and the missed softirq execution bug is still
there, but for a slightly different reason.

the bug/misbehavior causing bad latencies turned out to be the following:
if a hardirq triggers a softirq, but syscall-level code on the same CPU
disabled local bhs via local_bh_disable(), then we 'miss' the execution of
the softirq, until the next IRQ. (or next direct call to do_softirq()).

the attached softirq-2.4.5-B0 patch fixes this problem by calling
do_softirq() from local_bh_enable() [if the bh count is 0, to avoid
recursion]. This slightly changes local_bh_enable() semantics: calling
do_softirq() has the side-effect of disabling/enabling interrupts, so code
that used local_bh_enable while interrupts are disabled (and depended on
them staying disabled) will break. I checked all code that uses
local_bh_enable() via a debugging check, and the only (harmless) violation
of this new rule is machine_restart() in the x86 tree.

Yesterday's patches fix this problem too, but only as a lucky side-effect,
and only in the idle-poll case. 2.4.5 + softirq-2.4.5-B0 TCP latency is
down from a fluctuating 300-400 microseconds to a stable 109 microseconds.

Ingo

--8323328-739968658-990990035=:5852
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="softirq-2.4.5-B0"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.33.0105272100350.5852@localhost.localdomain>
Content-Description:
Content-Disposition: attachment; filename="softirq-2.4.5-B0"

LS0tIGxpbnV4L2tlcm5lbC9zb2Z0aXJxLmMub3JpZwlTdW4gTWF5IDI3IDIw
OjU3OjM2IDIwMDENCisrKyBsaW51eC9rZXJuZWwvc29mdGlycS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ribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/