From owner-freebsd-arch Mon Nov 12 15:58: 3 2001 Delivered-To: freebsd-arch@freebsd.org Received: from mail5.speakeasy.net (mail5.speakeasy.net [216.254.0.205]) by hub.freebsd.org (Postfix) with ESMTP id E40DC37B416 for ; Mon, 12 Nov 2001 15:57:59 -0800 (PST) Received: (qmail 10400 invoked from network); 12 Nov 2001 23:57:58 -0000 Received: from unknown (HELO laptop.baldwin.cx) ([64.81.54.73]) (envelope-sender ) by mail5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 12 Nov 2001 23:57:58 -0000 Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <200111122350.fACNojg07127@apollo.backplane.com> Date: Mon, 12 Nov 2001 15:57:52 -0800 (PST) From: John Baldwin To: Matthew Dillon Subject: Re: cur{thread/proc}, or not. Cc: freebsd-arch@FreeBSD.org, Robert Watson , Terry Lambert Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 12-Nov-01 Matthew Dillon wrote: > You want to be very careful not to bloat the concept. We > already have severe bloatage in the mutex code and that has > led to a lot of unnecessary complexity. A huge amount, > in fact. We have so many types of mutexes it makes my > head spin and I'm not very happy about it. Forget about > 'shared' verses 'exclusive'. A reference count is a > reference count, that's all. If you keep the concept > simple you can implement more functionality horizontally > rather then implementing more complexity vertically. Err, hang on. I wasn't doing shared counts. refcount_shared() would be a simple primitive to return true if the refcount was > 1. I was trying to see how the current API would fit with ucred mutexes, for example. If you had looked at the patch, you would find that the API is very simple. What I really should do is add atomic_fetchadd() (fetchadd on ia64, xadd on 486+, locked load /conditional store loop on alpha, simualted with atomic_cmpset() on opther archs if needed) and refcount_drop() can just be atomic_fetchadd(). This will change refcount_drop() to return the current value rather than if the value is zero. Please reread my mail and the patch itself. -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message