From owner-cvs-all@FreeBSD.ORG Fri Jul 18 13:31:03 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3F45E37B401; Fri, 18 Jul 2003 13:31:03 -0700 (PDT) Received: from pool-151-200-10-97.res.east.verizon.net (pool-138-88-10-151.res.east.verizon.net [138.88.10.151]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1376E43F85; Fri, 18 Jul 2003 13:31:02 -0700 (PDT) (envelope-from mtm@identd.net) Received: from kokeb.ambesa.net (39dcr06ljm8yjn2g@localhost [127.0.0.1]) id h6IKUwCs035105; Fri, 18 Jul 2003 16:30:58 -0400 (EDT) (envelope-from mtm@identd.net) Received: (from mtm@localhost) by kokeb.ambesa.net (8.12.9/8.12.9/Submit) id h6IKUwuA035104; Fri, 18 Jul 2003 16:30:58 -0400 (EDT) (envelope-from mtm@identd.net) X-Authentication-Warning: kokeb.ambesa.net: mtm set sender to mtm@identd.net using -f Date: Fri, 18 Jul 2003 16:30:58 -0400 From: Mike Makonnen To: Jeff Roberson Message-ID: <20030718203057.GA35054@kokeb.ambesa.net> References: <200307181758.h6IHwboW032513@repoman.freebsd.org> <20030718161814.F62545-100000@mail.chesapeake.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030718161814.F62545-100000@mail.chesapeake.net> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD/5.1-CURRENT (i386) cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern kern_umtx.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jul 2003 20:31:03 -0000 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!