Blob Blame History Raw
From f2e030dd7aaea5a937a2547dc980fab418fbc5e7 Mon Sep 17 00:00:00 2001
From: Almog Khaikin <almogkh@gmail.com>
Date: Tue, 26 Apr 2022 19:34:03 +0300
Subject: [PATCH] io_uring: replace smp_mb() with smp_mb__after_atomic() in
 io_sq_thread()
Git-commit: f2e030dd7aaea5a937a2547dc980fab418fbc5e7
Patch-mainline: v5.19-rc1
References: bsc#1205205

The IORING_SQ_NEED_WAKEUP flag is now set using atomic_or() which
implies a full barrier on some architectures but it is not required to
do so. Use the more appropriate smp_mb__after_atomic() which avoids the
extra barrier on those architectures.

Signed-off-by: Almog Khaikin <almogkh@gmail.com>
Link: https://lore.kernel.org/r/20220426163403.112692-1-almogkh@gmail.com
Fixes: 8018823e6987 ("io_uring: serialize ctx->rings->sq_flags with atomic_or/and")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 72cb2d50125c..1e7466079af7 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8229,7 +8229,7 @@ static int io_sq_thread(void *data)
 				 * Ensure the store of the wakeup flag is not
 				 * reordered with the load of the SQ tail
 				 */
-				smp_mb();
+				smp_mb__after_atomic();
 
 				if (io_sqring_entries(ctx)) {
 					needs_sched = false;
-- 
2.35.3