Date: Thu, 28 Mar 2002 09:28:43 -0500 (EST) From: John Baldwin <jhb@FreeBSD.org> To: Doug Rabson <dfr@nlsystems.com> Cc: arch@freebsd.org, Julian Elischer <julian@elischer.org> Subject: RE: SMP safe reference counting Message-ID: <XFMail.20020328092843.jhb@FreeBSD.org> In-Reply-To: <20020328093345.Y17999-100000@salmon.nlsystems.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 28-Mar-2002 Doug Rabson wrote: > 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. Ugh, I didn't know it was limited in what it could add. Hmmm, it would be nice to use that rather than a cmpxchg loop if possible. -- John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20020328092843.jhb>