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

2014-02-13 Thread David Miller
From: Greg KH Date: Thu, 13 Feb 2014 16:03:20 -0800 > So how about just "open coding" a kref for this structure, as it wants > something that doesn't fit into the kref model, and should be pretty > simple to do (you can ensure you get the locking right, unlike almost > all users of krefs, as Al

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

2014-02-13 Thread Greg KH
On Wed, Feb 12, 2014 at 11:09:53PM -0500, David Miller wrote: > From: David Miller > Date: Wed, 12 Feb 2014 23:05:06 -0500 (EST) > > > From: Greg KH > > Date: Wed, 12 Feb 2014 17:39:02 -0800 > > > >> Yes, that's horrible as well, but as was already pointed out in this > >> thread, you can't

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

2014-02-13 Thread Greg KH
On Wed, Feb 12, 2014 at 11:09:53PM -0500, David Miller wrote: From: David Miller da...@davemloft.net Date: Wed, 12 Feb 2014 23:05:06 -0500 (EST) From: Greg KH gre...@linuxfoundation.org Date: Wed, 12 Feb 2014 17:39:02 -0800 Yes, that's horrible as well, but as was already pointed out

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

2014-02-13 Thread David Miller
From: Greg KH gre...@linuxfoundation.org Date: Thu, 13 Feb 2014 16:03:20 -0800 So how about just open coding a kref for this structure, as it wants something that doesn't fit into the kref model, and should be pretty simple to do (you can ensure you get the locking right, unlike almost all

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

2014-02-12 Thread David Miller
From: David Miller Date: Wed, 12 Feb 2014 23:05:06 -0500 (EST) > From: Greg KH > Date: Wed, 12 Feb 2014 17:39:02 -0800 > >> Yes, that's horrible as well, but as was already pointed out in this >> thread, you can't rely on that value to really be "1" after reading it >> due to the way krefs

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

2014-02-12 Thread David Miller
From: Greg KH Date: Wed, 12 Feb 2014 17:39:02 -0800 > Yes, that's horrible as well, but as was already pointed out in this > thread, you can't rely on that value to really be "1" after reading it > due to the way krefs work, what happened if someone else just grabbed > it? > > If all they want

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

2014-02-12 Thread Greg KH
On Wed, Feb 12, 2014 at 07:06:37PM -0500, David Miller wrote: > From: Greg Kroah-Hartman > Date: Wed, 12 Feb 2014 08:56:30 -0800 > > > 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. >

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

2014-02-12 Thread Jörn Engel
On Wed, 12 February 2014 19:06:37 -0500, David Miller wrote: > > It isn't being used to determine when to destroy things. > > They use it to as a heuristic of when to trigger polling. > > Each ubuf attached gets a kref to the higher level virtio_net buffer > holding object, they want to trigger

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

2014-02-12 Thread David Miller
From: Greg Kroah-Hartman Date: Wed, 12 Feb 2014 08:56:30 -0800 > 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 >>

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

2014-02-12 Thread Anatol Pomozov
Hi On Wed, Feb 12, 2014 at 9:35 AM, Michael S. Tsirkin wrote: > On Wed, Feb 12, 2014 at 08:56:30AM -0800, Greg Kroah-Hartman wrote: >> 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. >>

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

2014-02-12 Thread Greg Kroah-Hartman
On Wed, Feb 12, 2014 at 07:35:24PM +0200, Michael S. Tsirkin wrote: > On Wed, Feb 12, 2014 at 08:56:30AM -0800, Greg Kroah-Hartman wrote: > > 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 > > >

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

2014-02-12 Thread Michael S. Tsirkin
On Wed, Feb 12, 2014 at 08:56:30AM -0800, Greg Kroah-Hartman wrote: > 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

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

2014-02-12 Thread Greg Kroah-Hartman
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 >

[PATCH net 1/3] kref: add kref_sub_return

2014-02-12 Thread Michael S. Tsirkin
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). Add an API to do this atomically and efficiently

[PATCH net 1/3] kref: add kref_sub_return

2014-02-12 Thread Michael S. Tsirkin
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). Add an API to do this atomically and efficiently

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

2014-02-12 Thread Greg Kroah-Hartman
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

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

2014-02-12 Thread Michael S. Tsirkin
On Wed, Feb 12, 2014 at 08:56:30AM -0800, Greg Kroah-Hartman wrote: 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

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

2014-02-12 Thread Greg Kroah-Hartman
On Wed, Feb 12, 2014 at 07:35:24PM +0200, Michael S. Tsirkin wrote: On Wed, Feb 12, 2014 at 08:56:30AM -0800, Greg Kroah-Hartman wrote: 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.

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

2014-02-12 Thread Anatol Pomozov
Hi On Wed, Feb 12, 2014 at 9:35 AM, Michael S. Tsirkin m...@redhat.com wrote: On Wed, Feb 12, 2014 at 08:56:30AM -0800, Greg Kroah-Hartman wrote: 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

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

2014-02-12 Thread David Miller
From: Greg Kroah-Hartman gre...@linuxfoundation.org Date: Wed, 12 Feb 2014 08:56:30 -0800 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

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

2014-02-12 Thread Jörn Engel
On Wed, 12 February 2014 19:06:37 -0500, David Miller wrote: It isn't being used to determine when to destroy things. They use it to as a heuristic of when to trigger polling. Each ubuf attached gets a kref to the higher level virtio_net buffer holding object, they want to trigger

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

2014-02-12 Thread Greg KH
On Wed, Feb 12, 2014 at 07:06:37PM -0500, David Miller wrote: From: Greg Kroah-Hartman gre...@linuxfoundation.org Date: Wed, 12 Feb 2014 08:56:30 -0800 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

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

2014-02-12 Thread David Miller
From: Greg KH gre...@linuxfoundation.org Date: Wed, 12 Feb 2014 17:39:02 -0800 Yes, that's horrible as well, but as was already pointed out in this thread, you can't rely on that value to really be 1 after reading it due to the way krefs work, what happened if someone else just grabbed it?

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

2014-02-12 Thread David Miller
From: David Miller da...@davemloft.net Date: Wed, 12 Feb 2014 23:05:06 -0500 (EST) From: Greg KH gre...@linuxfoundation.org Date: Wed, 12 Feb 2014 17:39:02 -0800 Yes, that's horrible as well, but as was already pointed out in this thread, you can't rely on that value to really be 1 after