io_uring: optimise commit_sqring() for common case
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 30 Dec 2019 18:24:46 +0000 (21:24 +0300)
committerJens Axboe <axboe@kernel.dk>
Tue, 21 Jan 2020 00:04:04 +0000 (17:04 -0700)
It should be pretty rare to not submitting anything when there is
something in the ring. No need to keep heuristics for this case.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index 3398f4052ec0e9b9d0b440a8159103f09854dc40..8613eae31f4c22a01e2d0725b4a849e3c7784821 100644 (file)
@@ -4501,14 +4501,12 @@ static void io_commit_sqring(struct io_ring_ctx *ctx)
 {
        struct io_rings *rings = ctx->rings;
 
-       if (ctx->cached_sq_head != READ_ONCE(rings->sq.head)) {
-               /*
-                * Ensure any loads from the SQEs are done at this point,
-                * since once we write the new head, the application could
-                * write new data to them.
-                */
-               smp_store_release(&rings->sq.head, ctx->cached_sq_head);
-       }
+       /*
+        * Ensure any loads from the SQEs are done at this point,
+        * since once we write the new head, the application could
+        * write new data to them.
+        */
+       smp_store_release(&rings->sq.head, ctx->cached_sq_head);
 }
 
 /*