Re: [RFC] Refcounting of objects part of a lockfree collection
From: Greg KH
Date: Wed Jul 14 2004 - 12:12:34 EST
On Wed, Jul 14, 2004 at 02:27:58PM +0530, Ravikiran G Thirumalai wrote:
> On Wed, Jul 14, 2004 at 12:07:00AM -0700, Greg KH wrote:
> > On Wed, Jul 14, 2004 at 10:23:50AM +0530, Ravikiran G Thirumalai wrote:
> > >
> > > The attatched patch provides infrastructure for refcounting of objects
> > > in a rcu protected collection.
> >
> > This is really close to the kref implementation. Why not just use that
> > instead?
>
> Close, but not the same. I just had a quick look at krefs.
> Actually, this refrerence count infrastructure I am proposing is not for
> traditional refcounting.
But you are advertising it as such by calling it a refcount_t and
putting it in a file called refcount.h.
> > Oh, and I think you need to use atomic_set() instead of initializing the
> > atomic_t by hand.
>
> I have used atomic_set for the case where arch has cmpxchg. But for
> arches lacking cmpxchg, I need to use hashed spinlocks to implement
> the ref_count_get_rcu.
> No point in having more atomic operations when I hold spinlocks. Admittedly,
> might be a bit yucky to assume atomic_t internals, but it is just one header
> file :) <ducks>
I still think you need to fix this, manipulating atomic_t variables by
hand is not always guaranteed to work on all arches, from what I
remember.
And what arches do not support cmpxchg? How does this change affect the
performance of them?
thanks,
greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/