io_uring: do task_work_run() during iopoll
authorPavel Begunkov <asml.silence@gmail.com>
Sun, 28 Jun 2020 09:52:37 +0000 (12:52 +0300)
committerJens Axboe <axboe@kernel.dk>
Sun, 28 Jun 2020 14:13:03 +0000 (08:13 -0600)
There are a lot of new users of task_work, and some of task_work_add()
may happen while we do io polling, thus make iopoll from time to time
to do task_work_run(), so it doesn't poll for sitting there reqs.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index f283d111666b768c0fe498162e46959b1257a2f1..c514a52097031720c2989538f08f9078cd6b98a1 100644 (file)
@@ -2052,6 +2052,8 @@ static int io_iopoll_check(struct io_ring_ctx *ctx, unsigned *nr_events,
                 */
                if (!(++iters & 7)) {
                        mutex_unlock(&ctx->uring_lock);
+                       if (current->task_works)
+                               task_work_run();
                        mutex_lock(&ctx->uring_lock);
                }