Skip to contentSkip to conversation

io_uring: use cond_resched() in sqthread

PATCH New Jens Axboe 1 participant 1 message Sep 19, 2019

Subsystems (2)
lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

PATCH 1/1 io_uring: use cond_resched() in sqthread

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.

---

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