Re: [PATCH 08/16] rcupdate: Replace smp_read_barrier_depends() with lockless_dereference()

From: Paul E. McKenney
Date: Tue Nov 18 2014 - 14:33:14 EST


On Thu, Nov 13, 2014 at 02:24:14PM -0500, Pranith Kumar wrote:
> 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@xxxxxxxxx>

Queued for 3.20, thank you! I was wondering about your removing the
"_" from "_________p1", but see that this allowed you to avoid the
checkpatch.pl warning. ;-)

Thanx, Paul

> ---
> include/linux/rcupdate.h | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> index ed4f593..386ba28 100644
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -582,11 +582,11 @@ static inline void rcu_preempt_sleep_check(void)
> })
> #define __rcu_dereference_check(p, c, space) \
> ({ \
> - typeof(*p) *_________p1 = (typeof(*p) *__force)ACCESS_ONCE(p); \
> + /* Dependency order vs. p above. */ \
> + typeof(*p) *________p1 = (typeof(*p) *__force)lockless_dereference(p); \
> rcu_lockdep_assert(c, "suspicious rcu_dereference_check() usage"); \
> rcu_dereference_sparse(p, space); \
> - smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
> - ((typeof(*p) __force __kernel *)(_________p1)); \
> + ((typeof(*p) __force __kernel *)(________p1)); \
> })
> #define __rcu_dereference_protected(p, c, space) \
> ({ \
> @@ -603,10 +603,10 @@ static inline void rcu_preempt_sleep_check(void)
> })
> #define __rcu_dereference_index_check(p, c) \
> ({ \
> - typeof(p) _________p1 = ACCESS_ONCE(p); \
> + /* Dependency order vs. p above. */ \
> + typeof(p) _________p1 = lockless_dereference(p); \
> rcu_lockdep_assert(c, \
> "suspicious rcu_dereference_index_check() usage"); \
> - smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
> (_________p1); \
> })
>
> --
> 1.9.1
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/