From owner-freebsd-current Mon Feb 11 19:50:54 2002 Delivered-To: freebsd-current@freebsd.org Received: from avocet.prod.itd.earthlink.net (avocet.mail.pas.earthlink.net [207.217.120.50]) by hub.freebsd.org (Postfix) with ESMTP id 395D837C3B4; Mon, 11 Feb 2002 19:07:20 -0800 (PST) Received: from pool0532.cvx22-bradley.dialup.earthlink.net ([209.179.200.22] helo=mindspring.com) by avocet.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16aTHr-0002WN-00; Mon, 11 Feb 2002 19:07:19 -0800 Message-ID: <3C6886C4.B2B08C5B@mindspring.com> Date: Mon, 11 Feb 2002 19:06:44 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: John Baldwin Cc: Alfred Perlstein , current@freebsd.org, bde@freebsd.org, Julian Elischer Subject: Re: ucred holding patch, BDE version References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG John Baldwin wrote: > Yes, calling free() without Giant is about as good as calling fdrop() without > Giant Alfred. :) Alfred would be right, for per processor memory pools. 8-). > >> And on the way into the system it does: > >> lock process > >> crhold() (which includes mutex ops) > >> unlock process > > > > This isn't needed, at least afaik. > > Not strictly for the comparison as Julian and Terry pointed out since the race > can occur anyway (i.e., you don't need the lock to see if p_ucred changed), > however, if you are actually doing a crhold(), you want to make sure p_ucred > isn't stale, so you need the proc lock. No. If you _depend_ on the frequency of change being low, you can do this with only atomic reference counts. See the pseudo code in my other posting, in direct response to you. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message