* [PATCH 1/1] io_uring: don't duplicate flushing in io_req_post_cqe
@ 2025-04-24 11:28 Pavel Begunkov
2025-04-24 12:31 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2025-04-24 11:28 UTC (permalink / raw)
To: io-uring; +Cc: asml.silence
io_req_post_cqe() sets submit_state.cq_flush so that
*flush_completions() can take care of batch commiting CQEs. Don't commit
it twice by using __io_cq_unlock_post().
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
io_uring/io_uring.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 0dc6c2f1295e..7099b488c5e1 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -873,10 +873,15 @@ bool io_req_post_cqe(struct io_kiocb *req, s32 res, u32 cflags)
lockdep_assert(!io_wq_current_is_worker());
lockdep_assert_held(&ctx->uring_lock);
- __io_cq_lock(ctx);
- posted = io_fill_cqe_aux(ctx, req->cqe.user_data, res, cflags);
+ if (!ctx->lockless_cq) {
+ spin_lock(&ctx->completion_lock);
+ posted = io_fill_cqe_aux(ctx, req->cqe.user_data, res, cflags);
+ spin_unlock(&ctx->completion_lock);
+ } else {
+ posted = io_fill_cqe_aux(ctx, req->cqe.user_data, res, cflags);
+ }
+
ctx->submit_state.cq_flush = true;
- __io_cq_unlock_post(ctx);
return posted;
}
--
2.48.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] io_uring: don't duplicate flushing in io_req_post_cqe
2025-04-24 11:28 [PATCH 1/1] io_uring: don't duplicate flushing in io_req_post_cqe Pavel Begunkov
@ 2025-04-24 12:31 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2025-04-24 12:31 UTC (permalink / raw)
To: io-uring, Pavel Begunkov
On Thu, 24 Apr 2025 12:28:39 +0100, Pavel Begunkov wrote:
> io_req_post_cqe() sets submit_state.cq_flush so that
> *flush_completions() can take care of batch commiting CQEs. Don't commit
> it twice by using __io_cq_unlock_post().
>
>
Applied, thanks!
[1/1] io_uring: don't duplicate flushing in io_req_post_cqe
(no commit info)
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-24 12:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 11:28 [PATCH 1/1] io_uring: don't duplicate flushing in io_req_post_cqe Pavel Begunkov
2025-04-24 12:31 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox