[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is MTX_CONTESTED evil?



John Baldwin <jhb_(_at_)_FreeBSD_(_dot_)_org> wrote:
> On Tuesday 23 March 2004 03:06 pm, Dag-Erling Sm??rgrav wrote:
> > des_(_at_)_des_(_dot_)_no (Dag-Erling Sm??rgrav) writes:
> > > John Baldwin <john_(_at_)_baldwin_(_dot_)_cx> writes:
> > > > Adaptive mutexes work just fine, but they aren't on by default.
> > >
> > > No, they don't "work just fine", unless of course they are *supposed*
> > > to cause frequent panics.
> >
> > s/panic/freeze/
> 
> They worked just fine on sparc64, alpha, and i386 when they were developed and 
> nothing has changed since then.  However, since they increase the chances of 
> "near concurrency" on multiple CPUs (i.e. one CPU grabbing a lock right after 
> another released it) they expose races and thus bugs in code that uses 
> mutexes improperly.  The fault is not in adaptive mutexes, but in the other 
> broken code, just as compile failures aren't the result of the tinderbox 
> itself being broken. :-)

Well, that certainly explains the blitz of crashes I had to fix recently!  
Since INVARIANTS and WITNESS are on by default, it would make sense to make 
ADAPTIVE_MUTEX default to catch more bugs.

-- 
Brian Fundakowski Feldman                           \'[ FreeBSD ]''''''''''\
  <> green_(_at_)_FreeBSD_(_dot_)_org                               \  The Power to Serve! \
 Opinions expressed are my own.                       \,,,,,,,,,,,,,,,,,,,,,,\