[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140212165630.GA22991@kroah.com>
Date: Wed, 12 Feb 2014 08:56:30 -0800
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: linux-kernel@...r.kernel.org, Jason Wang <jasowang@...hat.com>,
virtio-dev@...ts.oasis-open.org,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
davem@...emloft.net, qinchuanyu@...wei.com,
Joern Engel <joern@...fs.org>,
Anatol Pomozov <anatol.pomozov@...il.com>,
Nicholas Bellinger <nab@...ux-iscsi.org>
Subject: Re: [PATCH net 1/3] kref: add kref_sub_return
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists