From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>, io-uring@vger.kernel.org
Subject: Re: [PATCH 1/5] io_uring: optimise iowq refcounting
Date: Sat, 14 Aug 2021 13:38:25 -0600 [thread overview]
Message-ID: <fe8d2eea-a2a1-2c30-474a-edaae5cdcd09@kernel.dk> (raw)
In-Reply-To: <a583a8e2-68d0-9baf-c7c2-8a3a06848f4c@gmail.com>
On 8/14/21 1:36 PM, Pavel Begunkov wrote:
> On 8/14/21 8:31 PM, Pavel Begunkov wrote:
>> On 8/14/21 8:13 PM, Jens Axboe wrote:
>>> On 8/14/21 10:26 AM, Pavel Begunkov wrote:
>>>> If a requests is forwarded into io-wq, there is a good chance it hasn't
>>>> been refcounted yet and we can save one req_ref_get() by setting the
>>>> refcount number to the right value directly.
>>>
>>> Not sure this really matters, but can't hurt either. But...
>>
>> The refcount patches made this one atomic worse, and I just prefer
>> to not regress, even if slightly
>>
>>>> @@ -1115,14 +1115,19 @@ static inline void req_ref_get(struct io_kiocb *req)
>>>> atomic_inc(&req->refs);
>>>> }
>>>>
>>>> -static inline void io_req_refcount(struct io_kiocb *req)
>>>> +static inline void __io_req_refcount(struct io_kiocb *req, int nr)
>>>> {
>>>> if (!(req->flags & REQ_F_REFCOUNT)) {
>>>> req->flags |= REQ_F_REFCOUNT;
>>>> - atomic_set(&req->refs, 1);
>>>> + atomic_set(&req->refs, nr);
>>>> }
>>>> }
>>>>
>>>> +static inline void io_req_refcount(struct io_kiocb *req)
>>>> +{
>>>> + __io_req_refcount(req, 1);
>>>> +}
>>>> +
>>>
>>> I really think these should be io_req_set_refcount() or something like
>>> that, making it clear that we're actively setting/manipulating the ref
>>> count.
>>
>> Agree. A separate patch, maybe?
>
> I mean it just would be a bit easier for me, instead of rebasing
> this series and not yet sent patches.
I think it should come before this series at least, or be folded into the
first patch. So probably no way around the rebase, sorry...
--
Jens Axboe
next prev parent reply other threads:[~2021-08-14 19:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-14 16:26 [PATCH for-next 0/5] 5.15 cleanups and optimisations Pavel Begunkov
2021-08-14 16:26 ` [PATCH 1/5] io_uring: optimise iowq refcounting Pavel Begunkov
2021-08-14 19:13 ` Jens Axboe
2021-08-14 19:31 ` Pavel Begunkov
2021-08-14 19:36 ` Pavel Begunkov
2021-08-14 19:38 ` Jens Axboe [this message]
2021-08-15 9:41 ` Pavel Begunkov
2021-08-15 15:01 ` Jens Axboe
2021-08-14 19:37 ` Jens Axboe
2021-08-14 16:26 ` [PATCH 2/5] io_uring: don't inflight-track linked timeouts Pavel Begunkov
2021-08-14 16:26 ` [PATCH 3/5] io_uring: optimise initial ltimeout refcounting Pavel Begunkov
2021-08-14 16:26 ` [PATCH 4/5] io_uring: kill not necessary resubmit switch Pavel Begunkov
2021-08-14 16:26 ` [PATCH 5/5] io_uring: deduplicate cancellations Pavel Begunkov
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=fe8d2eea-a2a1-2c30-474a-edaae5cdcd09@kernel.dk \
--to=axboe@kernel.dk \
--cc=asml.silence@gmail.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;
as well as URLs for NNTP newsgroup(s).