From owner-freebsd-arch@FreeBSD.ORG Sat Aug 18 15:52:22 2007 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49F1C16A417; Sat, 18 Aug 2007 15:52:22 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 37ADA13C45A; Sat, 18 Aug 2007 15:52:22 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id ACC5D1A4D82; Sat, 18 Aug 2007 08:50:41 -0700 (PDT) Date: Sat, 18 Aug 2007 08:50:41 -0700 From: Alfred Perlstein To: Pawel Jakub Dawidek Message-ID: <20070818155041.GY90381@elvis.mu.org> References: <20070818120056.GA6498@garage.freebsd.pl> <20070818142337.GW90381@elvis.mu.org> <20070818150028.GD6498@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070818150028.GD6498@garage.freebsd.pl> User-Agent: Mutt/1.4.2.3i Cc: freebsd-arch@FreeBSD.org Subject: Re: Lockless uidinfo. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Aug 2007 15:52:22 -0000 * Pawel Jakub Dawidek [070818 07:59] wrote: > On Sat, Aug 18, 2007 at 07:23:37AM -0700, Alfred Perlstein wrote: > > * Pawel Jakub Dawidek [070818 05:31] wrote: > > > Hi. > > > > > > The patch below remove per-uidinfo locks: > > > > > > http://people.freebsd.org/~pjd/patches/uidinfo_lockless.patch > > > > In uifree() is it ok to manually check the refcount for 0? > > > > I'm gussing the hashmtx is used as a barrier? > > Yes, to lookup uidinfo you need to hold uihashtbl_mtx mutex, so once you > hold it and ui_ref is 0, noone will be able to reference it, because it > has to wait to look it up. And the field doesn't need to be volatile to prevent cached/opportunitic reads? -- - Alfred Perlstein