From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrea Parri Subject: [PATCH] ptr_ring: Remove now-redundant smp_read_barrier_depends() Date: Fri, 16 Feb 2018 12:06:13 +0100 Message-ID: <1518779173-30812-1-git-send-email-parri.andrea@gmail.com> Cc: Andrea Parri , "David S. Miller" , "Michael S. Tsirkin" , Jason Wang , John Fastabend , Eric Dumazet , netdev@vger.kernel.org To: linux-kernel@vger.kernel.org Return-path: Received: from mail-wm0-f67.google.com ([74.125.82.67]:55675 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934998AbeBPLG2 (ORCPT ); Fri, 16 Feb 2018 06:06:28 -0500 Sender: netdev-owner@vger.kernel.org List-ID: Because READ_ONCE() now implies smp_read_barrier_depends(), the smp_read_barrier_depends() in __ptr_ring_consume() is redundant; this commit removes it and updates the comments. Signed-off-by: Andrea Parri Cc: "David S. Miller" Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: John Fastabend Cc: Eric Dumazet Cc: Cc: --- include/linux/ptr_ring.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/ptr_ring.h b/include/linux/ptr_ring.h index b884b7794187e..ddfed1dce9369 100644 --- a/include/linux/ptr_ring.h +++ b/include/linux/ptr_ring.h @@ -296,13 +296,14 @@ static inline void *__ptr_ring_consume(struct ptr_ring *r) { void *ptr; + /* The READ_ONCE in __ptr_ring_peek guarantees that anyone + * accessing data through the pointer is up to date. Pairs + * with smp_wmb in __ptr_ring_produce. + */ ptr = __ptr_ring_peek(r); if (ptr) __ptr_ring_discard_one(r); - /* Make sure anyone accessing data through the pointer is up to date. */ - /* Pairs with smp_wmb in __ptr_ring_produce. */ - smp_read_barrier_depends(); return ptr; } -- 2.7.4