summaryrefslogtreecommitdiffstats
path: root/lib/percpu-refcount.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2014-06-28 14:10:12 +0200
committerTejun Heo <tj@kernel.org>2014-06-28 14:10:12 +0200
commitd630dc4c9adb41e5bd1e06df2dbeaf622469ddd5 (patch)
tree4dc8afb3469f6bb27f3737b48d398ea4fa10e3e6 /lib/percpu-refcount.c
parentpercpu-refcount, aio: use percpu_ref_cancel_init() in ioctx_alloc() (diff)
downloadlinux-d630dc4c9adb41e5bd1e06df2dbeaf622469ddd5.tar.xz
linux-d630dc4c9adb41e5bd1e06df2dbeaf622469ddd5.zip
percpu-refcount: one bit is enough for REF_STATUS
percpu-refcount currently reserves two lowest bits of its percpu pointer to indicate its state; however, only one bit is used for PCPU_REF_DEAD. Simplify it by removing PCPU_STATUS_BITS/MASK and testing PCPU_REF_DEAD directly. This also allows the compiler to choose a more efficient instruction depending on the architecture. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Kent Overstreet <kmo@daterainc.com> Cc: Christoph Lameter <cl@linux-foundation.org>
Diffstat (limited to 'lib/percpu-refcount.c')
-rw-r--r--lib/percpu-refcount.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c
index 963b7034a51b..17bce2bccc14 100644
--- a/lib/percpu-refcount.c
+++ b/lib/percpu-refcount.c
@@ -96,7 +96,7 @@ static void percpu_ref_kill_rcu(struct rcu_head *rcu)
/* Mask out PCPU_REF_DEAD */
pcpu_count = (unsigned __percpu *)
- (((unsigned long) pcpu_count) & ~PCPU_STATUS_MASK);
+ (((unsigned long) pcpu_count) & ~PCPU_REF_DEAD);
for_each_possible_cpu(cpu)
count += *per_cpu_ptr(pcpu_count, cpu);