Skip to content

Commit c98c81a

Browse files
isilenceaxboe
authored andcommitted
io_uring: merge conditional unlock flush helpers
There is no reason not to use __io_cq_unlock_post_flush for intermediate aux CQE flushing, all ->task_complete should apply there, i.e. if set it should be the submitter task. Combine them, get rid of of __io_cq_unlock_post() and rename the left function. This place was also taking a couple percents of CPU according to profiles for max throughput net benchmarks due to multishot recv flooding it with completions. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/bbed60734cbec2e833d9c7bdcf9741aada5d8aab.1687518903.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 0fdb9a1 commit c98c81a

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

io_uring/io_uring.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -637,18 +637,7 @@ static inline void io_cq_lock(struct io_ring_ctx *ctx)
637637
spin_lock(&ctx->completion_lock);
638638
}
639639

640-
/* keep it inlined for io_submit_flush_completions() */
641640
static inline void __io_cq_unlock_post(struct io_ring_ctx *ctx)
642-
{
643-
io_commit_cqring(ctx);
644-
if (!ctx->task_complete)
645-
spin_unlock(&ctx->completion_lock);
646-
647-
io_commit_cqring_flush(ctx);
648-
io_cqring_wake(ctx);
649-
}
650-
651-
static void __io_cq_unlock_post_flush(struct io_ring_ctx *ctx)
652641
{
653642
io_commit_cqring(ctx);
654643

@@ -1568,7 +1557,7 @@ static void __io_submit_flush_completions(struct io_ring_ctx *ctx)
15681557
}
15691558
}
15701559
}
1571-
__io_cq_unlock_post_flush(ctx);
1560+
__io_cq_unlock_post(ctx);
15721561

15731562
if (!wq_list_empty(&ctx->submit_state.compl_reqs)) {
15741563
io_free_batch_list(ctx, state->compl_reqs.first);

0 commit comments

Comments
 (0)