Thread (9 messages) 9 messages, 2 authors, 2014-07-23

question about kref API

From: 'Greg KH' <hidden>
Date: 2014-07-23 17:48:02

On Wed, Jul 23, 2014 at 05:33:19PM +0000, Jeff Haran wrote:
Clearly there are potential performance benefits in not needing to take
locks or mutexes when they are not necessary.
Of course there are.  But trust me, you need to use a lock here, as the
document tries to explain, otherwise your code is broken.
If you could elaborate on where the race condition is here, I think
you'd being doing both me and the community a great service.
Nice try with the "Do it for the community because I don't understand
this!" appeal, that doesn't work for me, sorry...

I think you need to go look at the code closer and not get confused with
functions like kref_sub(), which you should never use unless you know
exactly what you are doing, and even then, I strongly discourage their
use (which is why there are only 2 users in the kernel.)  Focus on the
"normal" kref functions, and again, look at in-kernel users for examples
of how to use this properly.

Also, what are you trying to gain here, do you want to use a kref in
your code?  If so, please submit patches showing your usage and I will
be glad to review them.

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help