summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2023-07-17 10:27:20 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-07-27 08:44:19 +0200
commitdc4a25fa75659515fd61980d77e071b406db73b0 (patch)
tree4f40e4e2886293b2f26a427516dbc97522a27215 /io_uring
parent297883bbcab1b48e97aeb8f1dd3dd99d13238a44 (diff)
downloadlinux-dc4a25fa75659515fd61980d77e071b406db73b0.tar.gz
linux-dc4a25fa75659515fd61980d77e071b406db73b0.tar.bz2
linux-dc4a25fa75659515fd61980d77e071b406db73b0.zip
io_uring: add reschedule point to handle_tw_list()
Commit f58680085478dd292435727210122960d38e8014 upstream. If CONFIG_PREEMPT_NONE is set and the task_work chains are long, we could be running into issues blocking others for too long. Add a reschedule check in handle_tw_list(), and flush the ctx if we need to reschedule. Cc: stable@vger.kernel.org # 5.10+ Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/io_uring.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 3d5fb465eed7..51e6ebe72caf 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -2214,9 +2214,12 @@ static void tctx_task_work(struct callback_head *cb)
}
req->io_task_work.func(req, &locked);
node = next;
+ if (unlikely(need_resched())) {
+ ctx_flush_and_put(ctx, &locked);
+ ctx = NULL;
+ cond_resched();
+ }
} while (node);
-
- cond_resched();
}
ctx_flush_and_put(ctx, &locked);