Skip to content

Commit e5f30f6

Browse files
isilenceaxboe
authored andcommitted
io_uring: ease timeout flush locking requirements
We don't need completion_lock for timeout flushing, don't take it. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/1e3dc657975ac445b80e7bdc40050db783a5935a.1670002973.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 6971253 commit e5f30f6

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

io_uring/io_uring.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -572,12 +572,11 @@ static void io_eventfd_flush_signal(struct io_ring_ctx *ctx)
572572

573573
void __io_commit_cqring_flush(struct io_ring_ctx *ctx)
574574
{
575-
if (ctx->off_timeout_used || ctx->drain_active) {
575+
if (ctx->off_timeout_used)
576+
io_flush_timeouts(ctx);
577+
if (ctx->drain_active) {
576578
spin_lock(&ctx->completion_lock);
577-
if (ctx->off_timeout_used)
578-
io_flush_timeouts(ctx);
579-
if (ctx->drain_active)
580-
io_queue_deferred(ctx);
579+
io_queue_deferred(ctx);
581580
spin_unlock(&ctx->completion_lock);
582581
}
583582
if (ctx->has_evfd)

io_uring/timeout.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ static inline void io_put_req(struct io_kiocb *req)
5050
}
5151

5252
static bool io_kill_timeout(struct io_kiocb *req, int status)
53-
__must_hold(&req->ctx->completion_lock)
5453
__must_hold(&req->ctx->timeout_lock)
5554
{
5655
struct io_timeout_data *io = req->async_data;
@@ -70,7 +69,6 @@ static bool io_kill_timeout(struct io_kiocb *req, int status)
7069
}
7170

7271
__cold void io_flush_timeouts(struct io_ring_ctx *ctx)
73-
__must_hold(&ctx->completion_lock)
7472
{
7573
u32 seq;
7674
struct io_timeout *timeout, *tmp;

0 commit comments

Comments
 (0)