diff --git a/fs/io_uring.c b/fs/io_uring.c index 23635ca4546d4dff6a429379ea1318fed1a0a9a4..5d89bf5abcd1e88a2b336319282f0399953f14a8 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5999,7 +5999,7 @@ static int io_sq_thread(void *data) * If submit got -EBUSY, flag us as needing the application * to enter the kernel to reap and flush events. */ - if (!to_submit || ret == -EBUSY) { + if (!to_submit || ret == -EBUSY || need_resched()) { /* * Drop cur_mm before scheduling, we can't hold it for * long periods (or over schedule()). Do this before @@ -6015,7 +6015,7 @@ static int io_sq_thread(void *data) * more IO, we should wait for the application to * reap events and wake us up. */ - if (!list_empty(&ctx->poll_list) || + if (!list_empty(&ctx->poll_list) || need_resched() || (!time_after(jiffies, timeout) && ret != -EBUSY && !percpu_ref_is_dying(&ctx->refs))) { if (current->task_works)