]> git.ipfire.org Git - thirdparty/linux.git/commit - lib/percpu-refcount.c
percpu-refcount: add helpers for ->percpu_count accesses
authorTejun Heo <tj@kernel.org>
Sat, 28 Jun 2014 12:10:13 +0000 (08:10 -0400)
committerTejun Heo <tj@kernel.org>
Sat, 28 Jun 2014 12:10:13 +0000 (08:10 -0400)
commiteae7975ddf031b3084f4a5f7d88f698aefad96fb
tree5e5dd384eac28d12ac6ebcf197f92f543bd44c0d
parentd630dc4c9adb41e5bd1e06df2dbeaf622469ddd5
percpu-refcount: add helpers for ->percpu_count accesses

* All four percpu_ref_*() operations implemented in the header file
  perform the same operation to determine whether the percpu_ref is
  alive and extract the percpu pointer.  Factor out the common logic
  into __pcpu_ref_alive().  This doesn't change the generated code.

* There are a couple places in percpu-refcount.c which masks out
  PCPU_REF_DEAD to obtain the percpu pointer.  Factor it out into
  pcpu_count_ptr().

* The above changes make the WARN_ON_ONCE() conditional at the top of
  percpu_ref_kill_and_confirm() the only user of REF_STATUS().  Test
  PCPU_REF_DEAD directly and remove REF_STATUS().

This patch doesn't introduce any functional change.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Kent Overstreet <kmo@daterainc.com>
Cc: Christoph Lameter <cl@linux-foundation.org>
include/linux/percpu-refcount.h
lib/percpu-refcount.c