[PATCH] drm: Replace kref with a simple atomic reference count

Alan Cox alan at lxorguk.ukuu.org.uk
Thu Nov 25 15:13:58 PST 2010


> void kref_get(struct kref *kref)
> {
>         WARN_ON(!atomic_read(&kref->refcount));
>         atomic_inc(&kref->refcount);
>         smp_mb__after_atomic_inc();
> }
> 
> which causes havoc when you are trying to keep a list of unreferenced
> objects. That's all I'm trying to avoid.

You cannot have a list of unreferenced objects, the list itself is a set
of references.

You might want something to scavenge objects whose refcount is the list
only but thats not quite the same thing, and kref's are quite happy if
used that way.

Alan


More information about the dri-devel mailing list