* [PATCH] ptr_ring: Remove now-redundant smp_read_barrier_depends()
@ 2018-02-16 11:06 Andrea Parri
2018-02-19 16:11 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Andrea Parri @ 2018-02-16 11:06 UTC (permalink / raw)
To: linux-kernel
Cc: Andrea Parri, David S. Miller, Michael S. Tsirkin, Jason Wang,
John Fastabend, Eric Dumazet, netdev
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 <parri.andrea@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: <linux-kernel@vger.kernel.org>
Cc: <netdev@vger.kernel.org>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ptr_ring: Remove now-redundant smp_read_barrier_depends()
2018-02-16 11:06 [PATCH] ptr_ring: Remove now-redundant smp_read_barrier_depends() Andrea Parri
@ 2018-02-19 16:11 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-02-19 16:11 UTC (permalink / raw)
To: parri.andrea
Cc: linux-kernel, mst, jasowang, john.fastabend, edumazet, netdev
From: Andrea Parri <parri.andrea@gmail.com>
Date: Fri, 16 Feb 2018 12:06:13 +0100
> 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 <parri.andrea@gmail.com>
Ok, if READ_ONCE() does a barrier now, this change makes sense.
Applied to net-next, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-19 16:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-16 11:06 [PATCH] ptr_ring: Remove now-redundant smp_read_barrier_depends() Andrea Parri
2018-02-19 16:11 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).