Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 22000
b: refs/heads/master
c: 8b5536b
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and Greg Kroah-Hartman committed Mar 20, 2006
1 parent 0e4be43 commit bf6f45b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 489447380a2921ec0e9154f773c44ab3167ede4b
refs/heads/master: 8b5536bbee53620f8d5f367987e5727ba36d886d
7 changes: 6 additions & 1 deletion trunk/lib/kref.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ int kref_put(struct kref *kref, void (*release)(struct kref *kref))
WARN_ON(release == NULL);
WARN_ON(release == (void (*)(struct kref *))kfree);

if (atomic_dec_and_test(&kref->refcount)) {
/*
* if current count is one, we are the last user and can release object
* right now, avoiding an atomic operation on 'refcount'
*/
if ((atomic_read(&kref->refcount) == 1) ||
(atomic_dec_and_test(&kref->refcount))) {
release(kref);
return 1;
}
Expand Down

0 comments on commit bf6f45b

Please sign in to comment.