Skip to content

Commit 115e12e

Browse files
stbuehleraxboe
authored andcommitted
io_uring: remove unnecessary barrier before reading cq head
The memory operations before reading cq head are unrelated and we don't care about their order. Document that the control dependency in combination with READ_ONCE and WRITE_ONCE forms a barrier we need. Signed-off-by: Stefan Bühler <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 4f7067c commit 115e12e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/io_uring.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,11 @@ static struct io_uring_cqe *io_get_cqring(struct io_ring_ctx *ctx)
431431
unsigned tail;
432432

433433
tail = ctx->cached_cq_tail;
434-
/* See comment at the top of the file */
435-
smp_rmb();
434+
/*
435+
* writes to the cq entry need to come after reading head; the
436+
* control dependency is enough as we're using WRITE_ONCE to
437+
* fill the cq entry
438+
*/
436439
if (tail - READ_ONCE(ring->r.head) == ring->ring_entries)
437440
return NULL;
438441

0 commit comments

Comments
 (0)