cvs commit: src/sys/kern kern_umtx.c

Mike Makonnen mtm at identd.net
Fri Jul 18 13:31:03 PDT 2003


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 at identd.net | D228 1A6F C64E 120A A1C9  A3AA DAE1 E2AF DBCC 68B9
mtm at FreeBSD.Org| FreeBSD - Unleash the Daemon!


More information about the cvs-src mailing list