cvs commit: src/sys/i386/i386 pmap.c

Bruce Evans bde at zeta.org.au
Wed Nov 10 12:37:16 GMT 2004


On Tue, 9 Nov 2004, Scott Long wrote:

> Stephan Uphoff wrote:
> > On Tue, 2004-11-09 at 13:02, Julian Elischer wrote:
> >>Can you explain why a spin mutex is more expensive than a sleep mutex (I
> >>assume this is uncontested)?
> >
> > cli() and sti() used for the critical section are expensive.
> > ( The spin mutex includes the critical section)
> >
> > I recall a USENIX paper about avoiding the cost of cli(),sti() by just
> > setting an in memory flag. The interrupt handler was modified to honor
> > the flag and delay interrupt processing until the flag was cleared.
> > This may have the potential to drastically decrease the cost of a spin
> > mutex if interrupts during critical regions are infrequent.
>
> You mean create a word, let's just call it an 'intrmask_t', that can be
> set and cleared by the OS and drivers, and checked in the interrupt
> handler to see if the interrupt should be serviced right away or not?
> Hmmm... we'd have to think up a name for the API..... hmmmm... maybe
> spl()?

That is the FreeBSD-[1-4] way.  It is a little different since it has an
array of flags (one for each interrupt).

In -current on i386's between rev.1.2 (2002/07/10) and 1.5 (2003/11/03) of
<machine/critnest.h>, the flag was named curthread->td_critnest.
intrmask_t's were still used, but only to record the deferred interrupts.

Bruce


More information about the cvs-src mailing list