public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: Siddhesh Poyarekar <siddhesh@gotplt.org>
Cc: Nicholas Guriev <nicholas@guriev.su>, libc-alpha@sourceware.org
Subject: Re: [PATCH v3] elf: Rewrite long RESOLVE_MAP macro to a debug friendly function
Date: Sun, 22 May 2022 15:24:25 -0700	[thread overview]
Message-ID: <20220522222425.hk5vde2erkyadxol@google.com> (raw)
In-Reply-To: <e4c17457-a039-0f26-1cfa-30e84c57f3ea@gotplt.org>

On 2022-05-15, Siddhesh Poyarekar wrote:
>On 15/05/2022 04:18, Fangrui Song wrote:
>>On 2022-05-14, Nicholas Guriev wrote:
>>>On Пн, 2022-05-09 at 19:08 +0530, Siddhesh Poyarekar wrote:
>>>>Please use __always_inline instead, which adds the inline keyword as
>>>>well as __attribute__ ((inline)).  That way gcc ensures that the
>>>>function is *always* inlined.
>>>
>>>That is not necessary. My original intention was to improve the
>>>debugging experience at this point. And the standard `inline` keyword
>>>allows one to control optimizations with the -O flag.
>
>You can't build glibc with anything less than -O2, so that's a moot 
>point.  If you don't use __always_inline here then you're not only 
>changing the debugging experience, but also potentially adding a 
>performance overhead.  gdb can do well enough in most cases of inlined 
>functions, so __always_inlined should not hamper that.

Hope that the -O2 requirement can be lifted:)

The original decision might be related to guaranteed inlining and relocations in -O0
but it should be revisited nowadays... (Both FreeBSD rtld and musl rtld allow -O0).

>>Looks good to me, I think the always_inline here does not affect
>>performance, as shown in my testing with a large PIE with many
>>R_*_RELATIVE (function call overhead is larger with a non-R_*_RELATIVE).
>
>If you want to make a decision based on this then please quantify it 
>more precisely with a microbenchmark added to benchtests.  Otherwise 
>just add __always_inline because it is a more minimal change.  TBH I'd 
>prefer the former because it then adds a new microbenchmark that we 
>can measure dynamic linker changes in future but I can live with the 
>latter.

Thanks. I can add __always_inline.
(I don't think it matters but I guess I just want to avoid a debate :))

  reply	other threads:[~2022-05-22 22:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02 14:51 [PATCH] " Nicholas Guriev
2022-05-02 21:20 ` Fangrui Song
2022-05-03 10:04   ` Nicholas Guriev
2022-05-03 20:12     ` Fāng-ruì Sòng
2022-05-07 13:33       ` [PATCH v3] " Nicholas Guriev
2022-05-09 13:38         ` Siddhesh Poyarekar
2022-05-14 14:27           ` Nicholas Guriev
2022-05-14 22:48             ` Fangrui Song
2022-05-15  0:58               ` Siddhesh Poyarekar
2022-05-22 22:24                 ` Fangrui Song [this message]
2022-05-23  7:28                   ` Siddhesh Poyarekar
2022-05-23 12:35                   ` Adhemerval Zanella
2022-05-23 13:02                     ` Siddhesh Poyarekar
2022-05-23 16:22                       ` Adhemerval Zanella
2022-05-23 16:33                         ` Siddhesh Poyarekar
2022-05-23 16:56                           ` Adhemerval Zanella
2022-05-03 19:14   ` [PATCH v2] " Nicholas Guriev

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=20220522222425.hk5vde2erkyadxol@google.com \
    --to=maskray@google.com \
    --cc=libc-alpha@sourceware.org \
    --cc=nicholas@guriev.su \
    --cc=siddhesh@gotplt.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 read-only IMAP folder(s) and NNTP newsgroup(s).