summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorStefan Bühler <source@stbuehler.de>2019-04-25 00:54:18 +0300
committerJens Axboe <axboe@kernel.dk>2019-04-30 18:40:02 +0300
commit115e12e58dbc055e98c965e3255aed7b20214f95 (patch)
treebe290c72e31a400bb1462eb4cacab2e4c8e64085 /fs
parent4f7067c3fb7f2974363a28c597a41949d971af02 (diff)
downloadlinux-115e12e58dbc055e98c965e3255aed7b20214f95.tar.xz
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 <source@stbuehler.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r--fs/io_uring.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index bb71b7f00bb3..3671a654a146 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -431,8 +431,11 @@ static struct io_uring_cqe *io_get_cqring(struct io_ring_ctx *ctx)
unsigned tail;
tail = ctx->cached_cq_tail;
- /* See comment at the top of the file */
- smp_rmb();
+ /*
+ * writes to the cq entry need to come after reading head; the
+ * control dependency is enough as we're using WRITE_ONCE to
+ * fill the cq entry
+ */
if (tail - READ_ONCE(ring->r.head) == ring->ring_entries)
return NULL;