Skip to content

Commit 80c18e4

Browse files
isilenceaxboe
authored andcommitted
io_uring: trigger eventfd for IOPOLL
Make sure io_iopoll_complete() tries to wake up eventfd, which currently is skipped together with io_cqring_ev_posted() for non-SQPOLL IOPOLL. Add an iopoll version of io_cqring_ev_posted(), duplicates a bit of code, but they actually use different sets of wait queues may be for better. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 3e2224c commit 80c18e4

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

fs/io_uring.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,16 @@ static void io_cqring_ev_posted(struct io_ring_ctx *ctx)
17131713
eventfd_signal(ctx->cq_ev_fd, 1);
17141714
}
17151715

1716+
static void io_cqring_ev_posted_iopoll(struct io_ring_ctx *ctx)
1717+
{
1718+
if (ctx->flags & IORING_SETUP_SQPOLL) {
1719+
if (waitqueue_active(&ctx->wait))
1720+
wake_up(&ctx->wait);
1721+
}
1722+
if (io_should_trigger_evfd(ctx))
1723+
eventfd_signal(ctx->cq_ev_fd, 1);
1724+
}
1725+
17161726
/* Returns true if there are no backlogged entries after the flush */
17171727
static bool __io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force,
17181728
struct task_struct *tsk,
@@ -2428,8 +2438,7 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events,
24282438
}
24292439

24302440
io_commit_cqring(ctx);
2431-
if (ctx->flags & IORING_SETUP_SQPOLL)
2432-
io_cqring_ev_posted(ctx);
2441+
io_cqring_ev_posted_iopoll(ctx);
24332442
io_req_free_batch_finish(ctx, &rb);
24342443

24352444
if (!list_empty(&again))

0 commit comments

Comments
 (0)