summaryrefslogtreecommitdiffstats
path: root/io_uring
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2022-09-08 16:56:55 +0100
committerJens Axboe <axboe@kernel.dk>2022-09-21 13:15:01 -0600
commit1f8d5bbe98a10da5348b0fab2fa679ef8d033be5 (patch)
tree652defbc3ff3430ed57241736968b4ca04256dfb /io_uring
parent9d54bd6a3bb495f2e7e4996efdaf1bef6ad62272 (diff)
downloadlinux-1f8d5bbe98a10da5348b0fab2fa679ef8d033be5.tar.gz
linux-1f8d5bbe98a10da5348b0fab2fa679ef8d033be5.tar.bz2
linux-1f8d5bbe98a10da5348b0fab2fa679ef8d033be5.zip
io_uring/iopoll: unify tw breaking logic
Let's keep checks for whether to break the iopoll loop or not same for normal and defer tw, this includes ->cached_cq_tail checks guarding against polling more than asked for. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/d2fa8a44f8114f55a4807528da438cde93815360.1662652536.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/io_uring.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index c6c32aa3bfe9..12e8acd30096 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1428,21 +1428,21 @@ static int io_iopoll_check(struct io_ring_ctx *ctx, long min)
*/
if (wq_list_empty(&ctx->iopoll_list) ||
io_task_work_pending(ctx)) {
+ u32 tail = ctx->cached_cq_tail;
+
if (!llist_empty(&ctx->work_llist))
__io_run_local_work(ctx, true);
+
if (task_work_pending(current) ||
wq_list_empty(&ctx->iopoll_list)) {
- u32 tail = ctx->cached_cq_tail;
-
mutex_unlock(&ctx->uring_lock);
io_run_task_work();
mutex_lock(&ctx->uring_lock);
-
- /* some requests don't go through iopoll_list */
- if (tail != ctx->cached_cq_tail ||
- wq_list_empty(&ctx->iopoll_list))
- break;
}
+ /* some requests don't go through iopoll_list */
+ if (tail != ctx->cached_cq_tail ||
+ wq_list_empty(&ctx->iopoll_list))
+ break;
}
ret = io_do_iopoll(ctx, !min);
if (ret < 0)