From: Jens Axboe <axboe@kernel.dk>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: io-uring <io-uring@vger.kernel.org>
Subject: Re: [PATCH] io_uring/uring_cmd: skip inline completion cleanup if unlocked
Date: Wed, 6 May 2026 10:24:05 -0600 [thread overview]
Message-ID: <d4ce3d3c-0a3a-4aff-9d5f-418a3bdd74c1@kernel.dk> (raw)
In-Reply-To: <CADUfDZpZJMdFywHApMO3h+bn3S-SCDvEAHJ2e9yGD0r=2kJ_FA@mail.gmail.com>
On 5/6/26 10:14 AM, Caleb Sander Mateos wrote:
> On Wed, May 6, 2026 at 4:04?AM Jens Axboe <axboe@kernel.dk> wrote:
>>
>> If the call path to __io_uring_cmd_done() is not locked, then we
>> cannot recycle the uring_cmd to our allocation cache. Check for
>> that and skip it, and let the normal locked completion flushing
>> do the cleanup.
>>
>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>>
>> ---
>>
>> This effectively defeats proper cache recyling for uring_cmd opcodes,
>> with the fix it's working fine again.
>>
>> diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
>> index 42be1be5b132..35e2aa8b9446 100644
>> --- a/io_uring/uring_cmd.c
>> +++ b/io_uring/uring_cmd.c
>> @@ -166,7 +166,9 @@ void __io_uring_cmd_done(struct io_uring_cmd *ioucmd, s32 ret, u64 res2,
>> req->cqe.flags |= IORING_CQE_F_32;
>> io_req_set_cqe32_extra(req, res2, 0);
>> }
>> - io_req_uring_cleanup(req, issue_flags);
>> + /* defer cleanup if not locked, otherwise cache recyling is skipped */
>
> "recycling"?
>
>> + if (!(issue_flags & IO_URING_F_UNLOCKED))
>> + io_req_uring_cleanup(req, issue_flags);
>
> Doesn't io_req_uring_cleanup() already check this?
True it does, I think all we need is:
>> @@ -211,6 +213,7 @@ int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
>> ac = io_uring_alloc_async_data(&req->ctx->cmd_cache, req);
>> if (!ac)
>> return -ENOMEM;
>> + req->flags |= REQ_F_NEED_CLEANUP;
>> ioucmd->sqe = sqe;
>> return 0;
>> }
to ensure it's called later too. I'll update it, thanks!
--
Jens Axboe
prev parent reply other threads:[~2026-05-06 16:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 11:04 [PATCH] io_uring/uring_cmd: skip inline completion cleanup if unlocked Jens Axboe
2026-05-06 16:14 ` Caleb Sander Mateos
2026-05-06 16:24 ` Jens Axboe [this message]
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=d4ce3d3c-0a3a-4aff-9d5f-418a3bdd74c1@kernel.dk \
--to=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=io-uring@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