[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wioWmE+Xy+RfVpc3q9EMh4NhqPVvWZp5=GqtoU6nZfxcA@mail.gmail.com>
Date: Mon, 11 May 2020 17:09:20 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
"the arch/x86 maintainers" <x86@...nel.org>,
stable <stable@...r.kernel.org>, "H.J. Lu" <hjl.tools@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
Jakub Jelinek <jakub@...hat.com>,
Oleksandr Natalenko <oleksandr@...hat.com>,
Arnd Bergmann <arnd@...db.de>,
Andrew Morton <akpm@...ux-foundation.org>,
David Laight <David.Laight@...lab.com>,
Masahiro Yamada <yamada.masahiro@...ionext.com>
Subject: Re: [PATCH v2] Kconfig: default to CC_OPTIMIZE_FOR_PERFORMANCE_O3 for
gcc >= 10
On Mon, May 11, 2020 at 5:04 PM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> Not inlining as aggressively is not necessarily a bad thing. It can
> be, of course. But I've actually also done gcc bugreports about gcc
> inlining too much, and generating _worse_ code as a result (ie
> inlinging things that were behind an "if (unlikely())" test, and
> causing the likely path to grow a stack fram and stack spills as a
> result).
In case people care, the bugzilla case I mentioned is this one:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49194
with example code on why it's actively wrong to inline.
Obviously, in the kernel, we can fix the obvious cases with "noinline"
and "always_inline", but those take care of the outliers. Having a
compiler that does reasonably well by default is a good thing, and
that very much includes *not* inlining mindlessly.
Linus
Powered by blists - more mailing lists