On Fri, Feb 25, 2005 at 04:46:35PM -0600, Corey Minyard wrote:
> Greg KH wrote:
> 
> >On Thu, Feb 24, 2005 at 05:27:25PM -0600, Corey Minyard wrote:
> > 
> >
> >>+
> >>+   /* It's wierd, but we use a usecount to track if an q entry is
> >>+      in use and when it should be reported back to the user. */
> >>+   atomic_t usecount;
> >>   
> >>
> >
> >Please use a kref here instead of rolling your own.
> > 
> >
> There's a trick I'm playing to avoid having to use a lock on the normal 
> entry_put() case.  It let's the entry_get() routine detect that the 
> object is about to be destroyed.  You can't do it with the current kref, 
> but you could easily extend kref to allow it.

No, kref is ment to have an external lock protect it from this kind of
race.  That's documented.

> It's simple to implement, but the documentation on how to use it will
> be 10 times larger than the code :).
> 
> I'll work on a patch to kref to add that, if you don't mind.

I'll always look at patches :)

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to