Skip to contentSkip to conversation

ptr_ring: Remove now-redundant smp_read_barrier_depends()

PATCH Applied Andrea Parri 2 participants 2 messages Feb 16, 2018 – Feb 19, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ptr_ring: Remove now-redundant smp_read_barrier_depends()

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.

Cc "David S. Miller" <[email protected]>
Cc "Michael S. Tsirkin" <[email protected]>
Cc Jason Wang <[email protected]>
Cc John Fastabend <[email protected]>
Cc Eric Dumazet <[email protected]>
---
 include/linux/ptr_ring.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
include/linux/ptr_ring.h +4 -3
index b884b7794187e..ddfed1dce9369 100644
@@ -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;
 }
 
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw

From: Andrea Parri <[email protected]>
Date: Fri, 16 Feb 2018 12:06:13 +0100

Quoted 5 lines

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.

Ok, if READ_ONCE() does a barrier now, this change makes sense.

Applied to net-next, thank you.