io_uring: remove unnecessary barrier after unsetting IORING_SQ_NEED_WAKEUP [Linux 5.1]

io_uring: remove unnecessary barrier after unsetting IORING_SQ_NEED_WAKEUP [Linux 5.1]

This Linux kernel change "io_uring: remove unnecessary barrier after unsetting IORING_SQ_NEED_WAKEUP" is included in the Linux 5.1 release. This change is authored by Stefan Bühler <source [at] stbuehler.de> on Wed Apr 24 23:54:22 2019 +0200. The commit for this change in Linux stable tree is 6297728 (patch).

io_uring: remove unnecessary barrier after unsetting IORING_SQ_NEED_WAKEUP

There is no operation to order with afterwards, and removing the flag is
not critical in any way.

There will always be a "race condition" where the application will
trigger IORING_ENTER_SQ_WAKEUP when it isn't actually needed.

Signed-off-by: Stefan Bühler <source@stbuehler.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 fs/io_uring.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 2ebc33c..77b247b 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1969,13 +1969,11 @@ static int io_sq_thread(void *data)
                finish_wait(&ctx->sqo_wait, &wait);

                ctx->sq_ring->flags &= ~IORING_SQ_NEED_WAKEUP;
-               smp_wmb();
                continue;
            }
            finish_wait(&ctx->sqo_wait, &wait);

            ctx->sq_ring->flags &= ~IORING_SQ_NEED_WAKEUP;
-           smp_wmb();
        }

        i = 0;

Leave a Reply

Your email address will not be published. Required fields are marked *