From owner-freebsd-arch Thu Mar 28 1:41:42 2002 Delivered-To: freebsd-arch@freebsd.org Received: from tele-post-20.mail.demon.net (tele-post-20.mail.demon.net [194.217.242.20]) by hub.freebsd.org (Postfix) with ESMTP id 6CA4B37B400; Thu, 28 Mar 2002 01:41:35 -0800 (PST) Received: from mailgate.nlsystems.com ([62.49.251.130] helo=herring.nlsystems.com) by tele-post-20.mail.demon.net with esmtp (Exim 3.35 #1) id 16qWPU-000FBm-0K; Thu, 28 Mar 2002 09:41:32 +0000 Received: from salmon.nlsystems.com (salmon [10.0.0.3]) by herring.nlsystems.com (8.11.2/8.11.2) with ESMTP id g2S9eE961737; Thu, 28 Mar 2002 09:40:14 GMT (envelope-from dfr@nlsystems.com) Date: Thu, 28 Mar 2002 09:36:38 +0000 (GMT) From: Doug Rabson To: John Baldwin Cc: Julian Elischer , Subject: RE: SMP safe reference counting In-Reply-To: Message-ID: <20020328093345.Y17999-100000@salmon.nlsystems.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Wed, 27 Mar 2002, John Baldwin wrote: > > On 27-Mar-2002 Julian Elischer wrote: > > > > [please remove -smp from your reply] > > > > Once again on the SMP list a lock is being used to make a reference count > > safe. I'd like to re-raise the issue of a safe reference counting > > fascility. > > > > what would be the semantics? > > I have refcount.patch :) What would be nice is to first implement > atomic_fetchadd() (xadd on 486+, some hack on 386, fetchadd on ia64, similar to > atomic_add on sparc64, alpha, and powerpc I believe, basically it would add a > value to a memory location and return the result). You can then use taht for > the reference_release (or whatever you call it). We could also use that to get > rid of the really bloated debug version that uses a mutex and have a much > smaller debug version that still uses atomic ops. The ia64 has a fetchadd instruction which can add a constant to memory, returning the old value. It is limited to adding only the constants -16. -8, -4, -1, 1, 4, 8, 16. -- Doug Rabson Mail: dfr@nlsystems.com Phone: +44 20 8348 6160 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message