Skip to content

Commit

Permalink
io_uring: merge conditional unlock flush helpers
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
isilence authored and axboe committed Jun 23, 2023
1 parent 0fdb9a1 commit c98c81a
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions io_uring/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,18 +637,7 @@ static inline void io_cq_lock(struct io_ring_ctx *ctx)
spin_lock(&ctx->completion_lock);
}

/* keep it inlined for io_submit_flush_completions() */
static inline void __io_cq_unlock_post(struct io_ring_ctx *ctx)
{
io_commit_cqring(ctx);
if (!ctx->task_complete)
spin_unlock(&ctx->completion_lock);

io_commit_cqring_flush(ctx);
io_cqring_wake(ctx);
}

static void __io_cq_unlock_post_flush(struct io_ring_ctx *ctx)
{
io_commit_cqring(ctx);

Expand Down Expand Up @@ -1568,7 +1557,7 @@ static void __io_submit_flush_completions(struct io_ring_ctx *ctx)
}
}
}
__io_cq_unlock_post_flush(ctx);
__io_cq_unlock_post(ctx);

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

0 comments on commit c98c81a

Please sign in to comment.