summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2014-09-24 13:31:48 -0400
committerTejun Heo <tj@kernel.org>2014-09-24 13:31:48 -0400
commit6251f9976af7656b6970a8820153f356430f5de2 (patch)
treeaa2d83279dfb125b9bbd88083a32bfa5e99bf3da /lib
parenta2237370194484ee6aeeff04b617e4b14d178966 (diff)
downloadblackbird-op-linux-6251f9976af7656b6970a8820153f356430f5de2.tar.gz
blackbird-op-linux-6251f9976af7656b6970a8820153f356430f5de2.zip
percpu_ref: minor code and comment updates
* Some comments became stale. Updated. * percpu_ref_tryget() unnecessarily initializes @ret. Removed. * A blank line removed from percpu_ref_kill_rcu(). * Explicit function name in a WARN format string replaced with __func__. * WARN_ON() in percpu_ref_reinit() converted to WARN_ON_ONCE(). Signed-off-by: Tejun Heo <tj@kernel.org> Reviewed-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/percpu-refcount.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c
index 070dab5e7d77..8ef3f5c20df6 100644
--- a/lib/percpu-refcount.c
+++ b/lib/percpu-refcount.c
@@ -108,7 +108,6 @@ static void percpu_ref_kill_rcu(struct rcu_head *rcu)
* reaching 0 before we add the percpu counts. But doing it at the same
* time is equivalent and saves us atomic operations:
*/
-
atomic_long_add((long)count - PCPU_COUNT_BIAS, &ref->count);
WARN_ONCE(atomic_long_read(&ref->count) <= 0,
@@ -120,8 +119,8 @@ static void percpu_ref_kill_rcu(struct rcu_head *rcu)
ref->confirm_kill(ref);
/*
- * Now we're in single atomic_t mode with a consistent refcount, so it's
- * safe to drop our initial ref:
+ * Now we're in single atomic_long_t mode with a consistent
+ * refcount, so it's safe to drop our initial ref:
*/
percpu_ref_put(ref);
}
@@ -134,8 +133,8 @@ static void percpu_ref_kill_rcu(struct rcu_head *rcu)
* Equivalent to percpu_ref_kill() but also schedules kill confirmation if
* @confirm_kill is not NULL. @confirm_kill, which may not block, will be
* called after @ref is seen as dead from all CPUs - all further
- * invocations of percpu_ref_tryget() will fail. See percpu_ref_tryget()
- * for more details.
+ * invocations of percpu_ref_tryget_live() will fail. See
+ * percpu_ref_tryget_live() for more details.
*
* Due to the way percpu_ref is implemented, @confirm_kill will be called
* after at least one full RCU grace period has passed but this is an
@@ -145,8 +144,7 @@ void percpu_ref_kill_and_confirm(struct percpu_ref *ref,
percpu_ref_func_t *confirm_kill)
{
WARN_ONCE(ref->pcpu_count_ptr & PCPU_REF_DEAD,
- "percpu_ref_kill() called more than once on %pf!",
- ref->release);
+ "%s called more than once on %pf!", __func__, ref->release);
ref->pcpu_count_ptr |= PCPU_REF_DEAD;
ref->confirm_kill = confirm_kill;
@@ -172,7 +170,7 @@ void percpu_ref_reinit(struct percpu_ref *ref)
int cpu;
BUG_ON(!pcpu_count);
- WARN_ON(!percpu_ref_is_zero(ref));
+ WARN_ON_ONCE(!percpu_ref_is_zero(ref));
atomic_long_set(&ref->count, 1 + PCPU_COUNT_BIAS);
OpenPOWER on IntegriCloud