Skip to content

Commit 78f9b61

Browse files
committed
io_uring: wake SQPOLL task when task_work is added to an empty queue
If there's no current work on the list, we still need to potentially wake the SQPOLL task if it is sleeping. This is ordered with the wait queue addition in sqpoll, which adds to the wait queue before checking for pending work items. Fixes: af5d68f ("io_uring/sqpoll: manage task_work privately") Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 428f138 commit 78f9b61

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

io_uring/io_uring.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,8 +1370,13 @@ static void io_req_normal_work_add(struct io_kiocb *req)
13701370
atomic_or(IORING_SQ_TASKRUN, &ctx->rings->sq_flags);
13711371

13721372
/* SQPOLL doesn't need the task_work added, it'll run it itself */
1373-
if (ctx->flags & IORING_SETUP_SQPOLL)
1373+
if (ctx->flags & IORING_SETUP_SQPOLL) {
1374+
struct io_sq_data *sqd = ctx->sq_data;
1375+
1376+
if (wq_has_sleeper(&sqd->wait))
1377+
wake_up(&sqd->wait);
13741378
return;
1379+
}
13751380

13761381
if (likely(!task_work_add(req->task, &tctx->task_work, ctx->notify_method)))
13771382
return;

0 commit comments

Comments
 (0)