summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-05-16 22:58:01 +0100
committerJens Axboe <axboe@kernel.dk>2021-06-14 08:23:04 -0600
commitaaa9f0f48172b190a835792abe63f8859372eeec (patch)
tree5f464cdfbd80b98ce8b200c7d1d9d230fa4ef95b /fs/io_uring.c
parente4b6d902a9e38f424ce118106ea4d1665b7951b5 (diff)
downloadlwn-aaa9f0f48172b190a835792abe63f8859372eeec.tar.gz
lwn-aaa9f0f48172b190a835792abe63f8859372eeec.zip
io_uring: improve sq_thread waiting check
If SQPOLL task finds a ring requesting it to continue running, no need to set wake flag to rest of the rings as it will be cleared in a moment anyway, so hide it in a single sqd->ctx_list loop. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/1ee5a696d9fd08645994c58ee147d149a8957d94.1621201931.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 24c0042b0de7..85d0184c585d 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6894,11 +6894,10 @@ static int io_sq_thread(void *data)
prepare_to_wait(&sqd->wait, &wait, TASK_INTERRUPTIBLE);
if (!io_sqd_events_pending(sqd)) {
- list_for_each_entry(ctx, &sqd->ctx_list, sqd_list)
- io_ring_set_wakeup_flag(ctx);
-
needs_sched = true;
list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) {
+ io_ring_set_wakeup_flag(ctx);
+
if ((ctx->flags & IORING_SETUP_IOPOLL) &&
!list_empty_careful(&ctx->iopoll_list)) {
needs_sched = false;