diff mbox series

io_uring: use cond_resched() in sqthread

Message ID d591d8c1-fb35-8ac3-0a4f-cb3a01aba114@kernel.dk (mailing list archive)
State New, archived
Headers show
Series io_uring: use cond_resched() in sqthread | expand

Commit Message

Jens Axboe Sept. 19, 2019, 3:48 p.m. UTC
If preempt isn't enabled in the kernel, we can run into hang issues with
sqthread submissions. Use cond_resched() to play nice instead of
cpu_relax(), if we end up starting the loop and not having any events
pending for submissions.

Signed-off-by: Jens Axboe <axboe@kernel.dk>

---
diff mbox series

Patch

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 854dedd885fa..05a299e80159 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2438,7 +2438,7 @@  static int io_sq_thread(void *data)
 			 * to sleep.
 			 */
 			if (inflight || !time_after(jiffies, timeout)) {
-				cpu_relax();
+				cond_resched();
 				continue;
 			}