* [PATCH] io_uring: use lockless_cq flag in io_req_complete_post()
@ 2025-02-12 0:51 Caleb Sander Mateos
2025-02-13 14:04 ` lizetao
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Caleb Sander Mateos @ 2025-02-12 0:51 UTC (permalink / raw)
To: Jens Axboe, Pavel Begunkov; +Cc: Caleb Sander Mateos, io-uring, linux-kernel
io_uring_create() computes ctx->lockless_cq as:
ctx->task_complete || (ctx->flags & IORING_SETUP_IOPOLL)
So use it to simplify that expression in io_req_complete_post().
Signed-off-by: Caleb Sander Mateos <[email protected]>
---
io_uring/io_uring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index ec98a0ec6f34..0bd94599df81 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -897,11 +897,11 @@ static void io_req_complete_post(struct io_kiocb *req, unsigned issue_flags)
/*
* Handle special CQ sync cases via task_work. DEFER_TASKRUN requires
* the submitter task context, IOPOLL protects with uring_lock.
*/
- if (ctx->task_complete || (ctx->flags & IORING_SETUP_IOPOLL)) {
+ if (ctx->lockless_cq) {
req->io_task_work.func = io_req_task_complete;
io_req_task_work_add(req);
return;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] io_uring: use lockless_cq flag in io_req_complete_post()
2025-02-12 0:51 [PATCH] io_uring: use lockless_cq flag in io_req_complete_post() Caleb Sander Mateos
@ 2025-02-13 14:04 ` lizetao
2025-02-18 17:29 ` Caleb Sander Mateos
2025-02-18 17:32 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: lizetao @ 2025-02-13 14:04 UTC (permalink / raw)
To: Caleb Sander Mateos
Cc: [email protected], [email protected],
Jens Axboe, Pavel Begunkov
Hi,
> -----Original Message-----
> From: Caleb Sander Mateos <[email protected]>
> Sent: Wednesday, February 12, 2025 8:51 AM
> To: Jens Axboe <[email protected]>; Pavel Begunkov <[email protected]>
> Cc: Caleb Sander Mateos <[email protected]>; io-
> [email protected]; [email protected]
> Subject: [PATCH] io_uring: use lockless_cq flag in io_req_complete_post()
>
> io_uring_create() computes ctx->lockless_cq as:
> ctx->task_complete || (ctx->flags & IORING_SETUP_IOPOLL)
>
> So use it to simplify that expression in io_req_complete_post().
>
> Signed-off-by: Caleb Sander Mateos <[email protected]>
> ---
> io_uring/io_uring.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index
> ec98a0ec6f34..0bd94599df81 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -897,11 +897,11 @@ static void io_req_complete_post(struct io_kiocb
> *req, unsigned issue_flags)
>
> /*
> * Handle special CQ sync cases via task_work. DEFER_TASKRUN
> requires
> * the submitter task context, IOPOLL protects with uring_lock.
> */
> - if (ctx->task_complete || (ctx->flags & IORING_SETUP_IOPOLL)) {
> + if (ctx->lockless_cq) {
When the completion_lock is not held, the req completion event needs to be handled through
the task_work mechanism, so this modification makes sense to me.
> req->io_task_work.func = io_req_task_complete;
> io_req_task_work_add(req);
> return;
> }
>
> --
> 2.45.2
>
Reviewed-by: Li Zetao <[email protected]>
---
Li Zetao
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] io_uring: use lockless_cq flag in io_req_complete_post()
2025-02-12 0:51 [PATCH] io_uring: use lockless_cq flag in io_req_complete_post() Caleb Sander Mateos
2025-02-13 14:04 ` lizetao
@ 2025-02-18 17:29 ` Caleb Sander Mateos
2025-02-18 17:32 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Caleb Sander Mateos @ 2025-02-18 17:29 UTC (permalink / raw)
To: Jens Axboe, Pavel Begunkov; +Cc: io-uring, linux-kernel
Hi Jens,
Gentle ping on this patch that Li Zetao reviewed last week. Do you
think the comment should be removed/reworded to match the new if
condition?
Thanks,
Caleb
On Tue, Feb 11, 2025 at 4:51 PM Caleb Sander Mateos
<[email protected]> wrote:
>
> io_uring_create() computes ctx->lockless_cq as:
> ctx->task_complete || (ctx->flags & IORING_SETUP_IOPOLL)
>
> So use it to simplify that expression in io_req_complete_post().
>
> Signed-off-by: Caleb Sander Mateos <[email protected]>
> ---
> io_uring/io_uring.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index ec98a0ec6f34..0bd94599df81 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -897,11 +897,11 @@ static void io_req_complete_post(struct io_kiocb *req, unsigned issue_flags)
>
> /*
> * Handle special CQ sync cases via task_work. DEFER_TASKRUN requires
> * the submitter task context, IOPOLL protects with uring_lock.
> */
> - if (ctx->task_complete || (ctx->flags & IORING_SETUP_IOPOLL)) {
> + if (ctx->lockless_cq) {
> req->io_task_work.func = io_req_task_complete;
> io_req_task_work_add(req);
> return;
> }
>
> --
> 2.45.2
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] io_uring: use lockless_cq flag in io_req_complete_post()
2025-02-12 0:51 [PATCH] io_uring: use lockless_cq flag in io_req_complete_post() Caleb Sander Mateos
2025-02-13 14:04 ` lizetao
2025-02-18 17:29 ` Caleb Sander Mateos
@ 2025-02-18 17:32 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2025-02-18 17:32 UTC (permalink / raw)
To: Pavel Begunkov, Caleb Sander Mateos; +Cc: io-uring, linux-kernel
On Tue, 11 Feb 2025 17:51:18 -0700, Caleb Sander Mateos wrote:
> io_uring_create() computes ctx->lockless_cq as:
> ctx->task_complete || (ctx->flags & IORING_SETUP_IOPOLL)
>
> So use it to simplify that expression in io_req_complete_post().
>
>
Applied, thanks!
[1/1] io_uring: use lockless_cq flag in io_req_complete_post()
commit: 62aa9805d123165102273eb277f776aaca908e0e
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-18 17:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-12 0:51 [PATCH] io_uring: use lockless_cq flag in io_req_complete_post() Caleb Sander Mateos
2025-02-13 14:04 ` lizetao
2025-02-18 17:29 ` Caleb Sander Mateos
2025-02-18 17:32 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox