percpu: Replace smp_read_barrier_depends() with lockless_dereference()
authorPranith Kumar <bobby.prani@gmail.com>
Fri, 21 Nov 2014 15:05:59 +0000 (10:05 -0500)
committerTejun Heo <tj@kernel.org>
Sat, 22 Nov 2014 14:33:17 +0000 (09:33 -0500)
Recently lockless_dereference() was added which can be used in place of
hard-coding smp_read_barrier_depends(). The following PATCH makes the change.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
include/linux/percpu-refcount.h

index d5c89e0dd0e6725c614b491c78b5bfafe9cc46f4..6b0c818721427d8d6c8f1c6406937c99fe0052b4 100644 (file)
@@ -128,10 +128,8 @@ static inline void percpu_ref_kill(struct percpu_ref *ref)
 static inline bool __ref_is_percpu(struct percpu_ref *ref,
                                          unsigned long __percpu **percpu_countp)
 {
-       unsigned long percpu_ptr = ACCESS_ONCE(ref->percpu_count_ptr);
-
        /* paired with smp_store_release() in percpu_ref_reinit() */
-       smp_read_barrier_depends();
+       unsigned long percpu_ptr = lockless_dereference(ref->percpu_count_ptr);
 
        if (unlikely(percpu_ptr & __PERCPU_REF_ATOMIC))
                return false;