Thread (13 messages) 13 messages, 4 authors, 2014-02-14

Re: [PATCH net 1/3] kref: add kref_sub_return

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2014-02-12 16:55:17
Also in: lkml, netdev

On Wed, Feb 12, 2014 at 06:38:21PM +0200, Michael S. Tsirkin wrote:
It is sometimes useful to get the value of the reference count after
decrement.
For example, vhost wants to execute some periodic cleanup operations
once number of references drops below a specific value, before it
reaches zero (for efficiency).
You should never care about what the value of the kref is, if you are
using it correctly :)

So I really don't want to add this function, as I'm sure people will use
it incorrectly.  You should only care if the reference drops to 0, if
not, then your usage doesn't really fit into the "kref" model, and so,
just use an atomic variable.

I really want to know why it matters for "efficiency" that you know this
number.  How does that help anything, as the number could then go up
later on, and the work you did at a "lower" number is obsolete, right?

thanks,

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