t/io_uring: get rid of useless read barriers
We don't need a read barrier when we have acquire semantics on reading
the CQ ring tail.
We also don't need acquire semantics on the SQ ring head, unless we're
using SQPOLL. A syscall transition will have happened for !SQPOLL.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/t/io_uring.c b/t/io_uring.c
index b9353ac..edbacee 100644
--- a/t/io_uring.c
+++ b/t/io_uring.c
@@ -661,8 +661,12 @@
static int prep_more_ios_uring(struct submitter *s, int max_ios)
{
struct io_sq_ring *ring = &s->sq_ring;
- unsigned index, tail, next_tail, prepped = 0;
- unsigned int head = atomic_load_acquire(ring->head);
+ unsigned head, index, tail, next_tail, prepped = 0;
+
+ if (sq_thread_poll)
+ head = atomic_load_acquire(ring->head);
+ else
+ head = *ring->head;
next_tail = tail = *ring->tail;
do {
@@ -741,7 +745,6 @@
do {
struct file *f;
- read_barrier();
if (head == atomic_load_acquire(ring->tail))
break;
cqe = &ring->cqes[head & cq_ring_mask];
@@ -796,7 +799,6 @@
do {
struct file *f;
- read_barrier();
if (head == atomic_load_acquire(ring->tail))
break;
index = head & cq_ring_mask;