From: Joanne Koong <joannelkoong@gmail.com>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: Jens Axboe <axboe@kernel.dk>,
io-uring@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 4/6] io_uring: use io_ring_submit_lock() in io_iopoll_req_issued()
Date: Tue, 16 Dec 2025 08:34:13 +0800 [thread overview]
Message-ID: <CAJnrk1YD=6qpZHRw31X4SRWGZcCraYzfSd0QjOuRg8HcsP+axA@mail.gmail.com> (raw)
In-Reply-To: <20251215200909.3505001-5-csander@purestorage.com>
On Tue, Dec 16, 2025 at 4:10 AM Caleb Sander Mateos
<csander@purestorage.com> wrote:
>
> Use the io_ring_submit_lock() helper in io_iopoll_req_issued() instead
> of open-coding the logic. io_ring_submit_unlock() can't be used for the
> unlock, though, due to the extra logic before releasing the mutex.
>
> Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
This looks good to me.
Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
> ---
> io_uring/io_uring.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index 6d6fe5bdebda..40582121c6a7 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -1670,15 +1670,13 @@ void io_req_task_complete(struct io_tw_req tw_req, io_tw_token_t tw)
> * accessing the kiocb cookie.
> */
> static void io_iopoll_req_issued(struct io_kiocb *req, unsigned int issue_flags)
> {
> struct io_ring_ctx *ctx = req->ctx;
> - const bool needs_lock = issue_flags & IO_URING_F_UNLOCKED;
>
> /* workqueue context doesn't hold uring_lock, grab it now */
> - if (unlikely(needs_lock))
> - mutex_lock(&ctx->uring_lock);
> + io_ring_submit_lock(ctx, issue_flags);
>
> /*
> * Track whether we have multiple files in our lists. This will impact
> * how we do polling eventually, not spinning if we're on potentially
> * different devices.
> @@ -1701,11 +1699,11 @@ static void io_iopoll_req_issued(struct io_kiocb *req, unsigned int issue_flags)
> if (READ_ONCE(req->iopoll_completed))
> wq_list_add_head(&req->comp_list, &ctx->iopoll_list);
> else
> wq_list_add_tail(&req->comp_list, &ctx->iopoll_list);
>
> - if (unlikely(needs_lock)) {
> + if (unlikely(issue_flags & IO_URING_F_UNLOCKED)) {
> /*
> * If IORING_SETUP_SQPOLL is enabled, sqes are either handle
> * in sq thread task context or in io worker task context. If
> * current task context is sq thread, we don't need to check
> * whether should wake up sq thread.
> --
> 2.45.2
>
next prev parent reply other threads:[~2025-12-16 0:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 20:09 [PATCH v5 0/6] io_uring: avoid uring_lock for IORING_SETUP_SINGLE_ISSUER Caleb Sander Mateos
2025-12-15 20:09 ` [PATCH v5 1/6] io_uring: use release-acquire ordering for IORING_SETUP_R_DISABLED Caleb Sander Mateos
2025-12-15 20:09 ` [PATCH v5 2/6] io_uring: clear IORING_SETUP_SINGLE_ISSUER for IORING_SETUP_SQPOLL Caleb Sander Mateos
2025-12-16 0:50 ` Joanne Koong
2025-12-16 2:29 ` Caleb Sander Mateos
2025-12-15 20:09 ` [PATCH v5 3/6] io_uring: ensure io_uring_create() initializes submitter_task Caleb Sander Mateos
2025-12-15 20:09 ` [PATCH v5 4/6] io_uring: use io_ring_submit_lock() in io_iopoll_req_issued() Caleb Sander Mateos
2025-12-16 0:34 ` Joanne Koong [this message]
2025-12-15 20:09 ` [PATCH v5 5/6] io_uring: factor out uring_lock helpers Caleb Sander Mateos
2025-12-15 20:09 ` [PATCH v5 6/6] io_uring: avoid uring_lock for IORING_SETUP_SINGLE_ISSUER Caleb Sander Mateos
2025-12-16 4:46 ` Joanne Koong
2025-12-16 6:24 ` Caleb Sander Mateos
2025-12-16 7:47 ` Joanne Koong
2025-12-16 8:14 ` Joanne Koong
2025-12-16 16:03 ` Caleb Sander Mateos
2025-12-17 2:41 ` Joanne Koong
2025-12-16 15:49 ` Caleb Sander Mateos
2025-12-16 5:21 ` [syzbot ci] " syzbot ci
2025-12-18 1:24 ` Caleb Sander Mateos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJnrk1YD=6qpZHRw31X4SRWGZcCraYzfSd0QjOuRg8HcsP+axA@mail.gmail.com' \
--to=joannelkoong@gmail.com \
--cc=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=io-uring@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox