search for: kref_sub

Displaying 6 results from an estimated 6 matches for "kref_sub".

Did you mean: kref_put
2014 Feb 12
6
[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,
2014 Feb 12
6
[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,
2014 Feb 12
0
[PATCH net 1/3] kref: add kref_sub_return
...f this - * function returns 0, you still can not count on the kref from remaining in + * function returns 0, you still can not count on the kref remaining in * memory. Only use the return value if you want to see if the kref is now * gone, not present. */ @@ -78,6 +78,38 @@ static inline int kref_sub(struct kref *kref, unsigned int count, } /** + * kref_sub_return - subtract a number of refcounts for object. + * @kref: object. + * @count: Number of recounts to subtract. + * @release: pointer to the function that will clean up the object when the + * last reference to the object is rele...
2014 Feb 12
0
[PATCH net 1/3] kref: add kref_sub_return
...hould 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. This happens when you have code that keeps reference itself implicitly or explicitly. foo(struct kref *k, int bar) { sub = kref_sub(k) if (sub == 1) FOO(k, bar) /* Here I am the only one with a reference */ } kref_get(k) foo(k, bar); .... kref_put(k) Why not do FOO in destructor you ask? Absolutely but this will be called much later. Maybe you will reconsider if I document this as the only legal use? &gt...
2014 Feb 12
4
[PATCH net 0/3] vhost fixes for 3.14, -stable
This fixes a deadlock with vhost reported in the field, as well as a theoretical race issue found by code review. Patches 1+2 are needed for stable. Thanks to Qin Chuanyu for reporting the issue! Michael S. Tsirkin (3): kref: add kref_sub_return vhost: fix ref cnt checking deadlock vhost: fix a theoretical race in device cleanup include/linux/kref.h | 33 ++++++++++++++++++++++++++++++++- drivers/vhost/net.c | 15 ++++++++++----- 2 files changed, 42 insertions(+), 6 deletions(-) -- MST
2014 Feb 12
4
[PATCH net 0/3] vhost fixes for 3.14, -stable
This fixes a deadlock with vhost reported in the field, as well as a theoretical race issue found by code review. Patches 1+2 are needed for stable. Thanks to Qin Chuanyu for reporting the issue! Michael S. Tsirkin (3): kref: add kref_sub_return vhost: fix ref cnt checking deadlock vhost: fix a theoretical race in device cleanup include/linux/kref.h | 33 ++++++++++++++++++++++++++++++++- drivers/vhost/net.c | 15 ++++++++++----- 2 files changed, 42 insertions(+), 6 deletions(-) -- MST