Subject: Re: Heads up
To: None <current-users@NetBSD.org>
From: Andrew Doran <email@example.com>
Date: 12/03/2007 18:46:51
On Mon, Dec 03, 2007 at 12:29:06PM -0600, David Young wrote:
> On Mon, Dec 03, 2007 at 06:21:59PM +0000, Andrew Doran wrote:
> > - Soft interrupts are now threaded, so it's possible to take adaptive mutexes
> > and reader/writer locks from a soft interrupt (for example, in a callout).
> > These have no ordering constraint against kernel_lock and so are "deadlock
> > free" in that respect.
> How will this affect the performance of soft interrupts? I saw a marked
> performance improvement in gre(4) when I made it use software interrupts
> instead of a thread. Do you think that the improvement will disappear
> if I measure again, now?
See kern/kern_softint.c for details. While kthreads are used to back the
soft interrupts they are not scheduled as normal kthreads because that's far
too expensive. There's no context switch involved in taking the interrupt.
If a soft interrupt handler needs to sleep then it will context switch, but
if the use of locks is done well enough then that occurs rarely.