lkml.org 
[lkml]   [2005]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] New operation for kref to help avoid locks
From
Date
On Tue, 2005-03-01 at 12:15 -0800, Greg KH wrote:
> On Sat, Feb 26, 2005 at 04:23:04PM -0600, Corey Minyard wrote:
> > Add a routine to kref that allows the kref_put() routine to be
> > unserialized even when the get routine attempts to kref_get()
> > an object without first holding a valid reference to it. This is
> > useful in situations where this happens multiple times without
> > freeing the object, as it will avoid having to do a lock/semaphore
> > except on the final kref_put().
> >
> > This also adds some kref documentation to the Documentation
> > directory.
>
> I like the first part of the documentation, that's nice.
>
> But I don't like the new kref_get_with_check() function that you
> implemented. If you look in the -mm tree, kref_put() now returns if
> this was the last put on the reference count or not, to help with lists
> of objects with a kref in it.
>
> Perhaps you can use that to implement what you need instead?

note that I'm not convinced the "lockless" implementation actually is
faster. It still uses an atomic variable, which is just as expensive as
taking a lock normally...

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

\
 
 \ /
  Last update: 2005-03-22 14:10    [W:0.111 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site