Skip to contentSkip to conversation

io_uring: replace smp_mb() with smp_mb__after_atomic() in io_sq_thread()

PATCH Applied Almog Khaikin 2 participants 2 messages Apr 26, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring: replace smp_mb() with smp_mb__after_atomic() in io_sq_thread()

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.

---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/io_uring.c +1 -1
index 72cb2d50125c..1e7466079af7 100644
@@ -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;

base-commit: 6f07a54a90ee98ae13b37ac358624d7cc7e57850

Signature · 1 line
2.36.0
maintainer Applied
#1 lore raw
Quoted 6 lines · Almog Khaikin

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.

Applied, thanks!

[1/1] io_uring: replace smp_mb() with smp_mb__after_atomic() in io_sq_thread()

      commit: 012b7e911e69791ea518ef3d084c12cb2b8f2914

Best regards,

Signature · 1 line
Jens Axboe