Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Mar 2002 17:37:11 -0500 (EST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Julian Elischer <julian@elischer.org>
Cc:        arch@FreeBSD.ORG, Bosko Milekic <bmilekic@unixdaemons.com>
Subject:   Re: SMP safe reference counting
Message-ID:  <XFMail.20020328173711.jhb@FreeBSD.org>
In-Reply-To: <Pine.BSF.4.21.0203281412340.53693-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 28-Mar-2002 Julian Elischer wrote:
> 
> 
> On Thu, 28 Mar 2002, Bosko Milekic wrote:
> 
>> 
>> On Thu, Mar 28, 2002 at 09:45:02AM -0500, John Baldwin wrote:
>> > 
>> > On 28-Mar-2002 Bosko Milekic wrote:
>> > > 
>> > >   I don't think we really need a ref. count API, per-se.  I can think of
>> > >  several places that may need to do ref. counting but wouldn't want to
>> > >  do it with a bus-locked instruction because their reference counter(s)
>> > >  are already protected by an existing mutex.
>> > > 
>> > >  -Bosko
>> > 
>> > Those places wouldn't use the API then I think.  However, this would be
>> > good
>> > for things like ucreds, pargs, uidinfos and others.
>> 
>>   Yeah, absolutely.  I was just pointing out that there's little point
>>  in having a reference counting API when a lot of the reference counting
>>  implementations won't be using it.
> 
> but a lot would.. and that's GOOD.
> 
> John, can you put your sugfgested API up again?
> I remember it would work but was (in my mind) 'different'.
> I didn't think it was intuative but at least get it up for discussion..
> 
> (I posted my suggested API a few mails ago.. I'm sure it too has
> weaknesses though)

It's old but it's been at ~jhb/paches/refcount.patch for about an eternity
right now.  The changes I would make to it are that I would change
refcount_drop() (or release or whatever it is called) to return the current
value rather than a boolean about the value being 0 or not.  Also, once
atomic_fetchadd() is done, it will change a fair bit.  There would just be
a MI header, no MD stuff, and we woudln't use a mutex for the debug version
that uses asserts.

> Julian

-- 

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.20020328173711.jhb>