]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
io_uring: use cond_resched() in sqthread
authorJens Axboe <axboe@kernel.dk>
Thu, 19 Sep 2019 15:48:55 +0000 (09:48 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 19 Sep 2019 15:49:26 +0000 (09:49 -0600)
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>
fs/io_uring.c

index 854dedd885fa8ddce8e4d2c9a8efee45f7cb3b5a..05a299e80159b558124c7d3895388e5340e938cc 100644 (file)
@@ -2438,7 +2438,7 @@ static int io_sq_thread(void *data)
                         * to sleep.
                         */
                        if (inflight || !time_after(jiffies, timeout)) {
-                               cpu_relax();
+                               cond_resched();
                                continue;
                        }