[lkml]   [2019]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly
Hi Miguel,

On Thu, Oct 3, 2019 at 10:21 PM Miguel Ojeda
<> wrote:
> On Thu, Oct 3, 2019 at 7:29 PM Linus Torvalds
> <> wrote:
> > On Thu, Oct 3, 2019 at 10:24 AM Masahiro Yamada
> > <> wrote:
> > >
> > > I just want to annotate __always_inline for the case
> > > "2. code that if not inlined is somehow not correct."
> >
> > Oh, I support that entirely - if only for documentation.
> >
> > But I do *not* support the dismissal of the architecture maintainers
> > concerns about "does it work?" and apparently known compiler bugs.
> >
> > > Again, not saying "use a macro".
> >
> > Other people did, though.
> >
> > And there seemed to be little balancing of the pain vs the gain. The
> > gain really isn't that obvious. If the code shrinks by a couple of kB,
> > is that good or bad? Maybe it is smaller, but is it _better_?
> I think both positions that people have shown are important to take
> into account.
> We should minimize our usage of macros wherever possible and certainly
> not write new ones when another solution is available. But we should
> *also* minimize our dependence on code that "must-be-inlined" to work
> as much as possible.
> In particular, I think we should allow to use __always_inline only if
> it doesn't work otherwise, as an alternative before trying the next
> worst solution (macros). And avoid using only "inline" when we
> actually require inlining, of course.
> And the reasoning for each usage of __always_inline should have a
> comment (be it "bad codegen", "performance tanks without it",
> "compiler X <= 4.2 refuses to compile"...). Which is also useful for
> compiler folks to grep for cases to improve/fix in their compiler!

First, we had "inline" and normal functions, where "inline" was used to
make sure a function was inlined (e.g. because it contained code paths
that were intended to be optimized away[*]).
Then, the compiler started not honoring the "inline" keyword, so we got
"always_inline", "inline", and normal functions. With a hack to #define
"inline" to "always_inline" for some compiler versions.

What's next? There should be a way for the programmer to indicate a
function must be inlined.

[*] Some unused code paths may contain references to symbols that may
not exist for the current configuration, or not exist at all.



Geert Uytterhoeven -- There's lots of Linux beyond ia32 --

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

 \ /
  Last update: 2019-10-04 09:38    [W:0.446 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site