Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jul 2003 16:30:58 -0400
From:      Mike Makonnen <mtm@identd.net>
To:        Jeff Roberson <jroberson@chesapeake.net>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern kern_umtx.c
Message-ID:  <20030718203057.GA35054@kokeb.ambesa.net>
In-Reply-To: <20030718161814.F62545-100000@mail.chesapeake.net>
References:  <200307181758.h6IHwboW032513@repoman.freebsd.org> <20030718161814.F62545-100000@mail.chesapeake.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jul 18, 2003 at 04:18:31PM -0400, Jeff Roberson wrote:
> On Fri, 18 Jul 2003, Mike Makonnen wrote:
> 
> > mtm         2003/07/18 10:58:37 PDT
> >
> >   FreeBSD src repository
> >
> >   Modified files:
> >     sys/kern             kern_umtx.c
> >   Log:
> >   Move the decision on whether to unset the contested
> >   bit or not from lock to unlock time.
> >
> >   Suggested by:   jhb
> >
> >   Revision  Changes    Path
> >   1.9       +40 -48    src/sys/kern/kern_umtx.c
> >
> 
> I assume this fixes some race?  Can you describe the scenario?

It doesn't fix a race. In the previous commit I unset the
contested bit at lock time. If a thread that locked a umtx
found that there were no threads blocking on it in the kernel
it unset the contested bit. I did it this way because I thought
making the decision at unlock time would introduce a race between
a thread trying to acquire it for the first time and a thread
already blocking on it. As it turns out this is not necessary
(and in any case didn't solve that particular race). So, John
suggested moving the decision to unlock time so that a thread
locking an uncontested mutex (that used to be contested) doesn't
have to go into the kernel.

Hope that's clear :-)

Cheers.
-- 
Mike Makonnen  | GPG-KEY: http://www.identd.net/~mtm/mtm.asc
mtm@identd.net | D228 1A6F C64E 120A A1C9  A3AA DAE1 E2AF DBCC 68B9
mtm@FreeBSD.Org| FreeBSD - Unleash the Daemon!



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030718203057.GA35054>