Date: Wed, 10 Nov 2004 23:37:06 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Scott Long <scottl@FreeBSD.org> Cc: Julian Elischer <julian@elischer.org> Subject: Re: cvs commit: src/sys/i386/i386 pmap.c Message-ID: <20041110231010.O810@epsplex.bde.org> In-Reply-To: <41910D86.3080605@freebsd.org> References: <Pine.NEB.3.96L.1041109103037.73102S-100000@fledge.watson.org> <4191062A.6090009@elischer.org> <1100024464.29384.30.camel@palm.tree.com> <41910D86.3080605@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041110231010.O810>