All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, io-uring <io-uring@vger.kernel.org>
Subject: Re: [PATCH] io_uring: kill io_cqring_ev_posted() and __io_cq_unlock_post()
Date: Thu, 24 Nov 2022 19:51:56 +0000	[thread overview]
Message-ID: <0eeed468-6500-8e55-3697-986f1ba22183@gmail.com> (raw)
In-Reply-To: <672d1714-7bf6-db8e-39ae-daa7f155d2c4@kernel.dk>

On 11/24/22 19:29, Jens Axboe wrote:
> On 11/24/22 12:17?PM, Pavel Begunkov wrote:
>> On 11/24/22 18:46, Jens Axboe wrote:
>>> On 11/24/22 9:16?AM, Pavel Begunkov wrote:
>>>> On 11/21/22 14:52, Jens Axboe wrote:
>>>>> __io_cq_unlock_post() is identical to io_cq_unlock_post(), and
>>>>> io_cqring_ev_posted() has a single caller so migth as well just inline
>>>>> it there.
>>>>
>>>> It was there for one purpose, to inline it in the hottest path,
>>>> i.e. __io_submit_flush_completions(). I'll be reverting it back
>>>
>>> The compiler is most certainly already doing that, in fact even
>>
>> .L1493:
>> # io_uring/io_uring.c:631:???? io_cq_unlock_post(ctx);
>> ????movq??? %r15, %rdi??? # ctx,
>> ????call??? io_cq_unlock_post??? #
> 
> Doubled checked here, and you're actually right:
> 
>      55bc:       94000000        bl      4760 <io_cq_unlock_post>
> 
> Huh, that's very odd that it doesn't inline it. It doesn't even it I
> mark it inline, __always_inline gets it done.

That's odd as well for a function of this size

>> Even more, after IORING_SETUP_CQE32 was added I didn't see
>> once __io_fill_cqe_req actually inlined even though it's marked
>> so.
> 
> Doesn't seem to be inlined here either. Compiler:
> 
> gcc (Debian 12.2.0-9) 12.2.0
> 
>>> __io_submit_flush_completions() is inlined in
>>> io_submit_flush_completions() for me here.
>>
>> And io_submit_flush_completions is inlined as well, right?
>> That would be quite odd, __io_submit_flush_completions() is not
>> small by any means and there are 3 call sites.
> 
> io_submit_flush_completions() doesn't get inlined,
> __io_submit_flush_completions() gets inlined in
> io_submit_flush_completions().

Then the compiler is drunk. It doesn't inline the function
explicitly marked inline but does it for a non-inline one.
Unless it's PGO'ed I can't think of a sane reason for it.

-- 
Pavel Begunkov

      reply	other threads:[~2022-11-24 19:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21 14:52 [PATCH] io_uring: kill io_cqring_ev_posted() and __io_cq_unlock_post() Jens Axboe
2022-11-24 16:16 ` Pavel Begunkov
2022-11-24 18:46   ` Jens Axboe
2022-11-24 19:17     ` Pavel Begunkov
2022-11-24 19:19       ` Pavel Begunkov
2022-11-24 19:29       ` Jens Axboe
2022-11-24 19:51         ` Pavel Begunkov [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=0eeed468-6500-8e55-3697-986f1ba22183@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.