linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: josh@joshtriplett.org
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>, Andi Kleen <ak@linux.intel.com>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [GIT] kbuild/lto changes for 3.15-rc1
Date: Tue, 8 Apr 2014 13:49:06 -0700	[thread overview]
Message-ID: <20140408204906.GA3616@cloud> (raw)
In-Reply-To: <CA+55aFy8hWqBpF1TXOPvA2rRaZp=H2LTO3wd3AERspmcGZhAeQ@mail.gmail.com>

On Tue, Apr 08, 2014 at 08:26:09AM -0700, Linus Torvalds wrote:
> On Mon, Apr 7, 2014 at 1:19 PM, Michal Marek <mmarek@suse.cz> wrote:
> > besides the kbuild branch, here is the LTO build support by Andi. It is
> > a separate branch, because it depends on other patches by Andi which
> > were merged through other trees. The link-time-optimization build is an
> > experimental feature, so there one kconfig option to enable it and
> > another kconfig option to disable it (behind a door with a sign "Beware
> > of the Leopard"...), so that it is not enabled by
> > allmodconfig/allyesconfig.
> 
> So right now, I see several reasons not to merge it ("It's so
> experimental that we don't even want to encourage people to test it"
> to "it's not fully fleshed out yet and makes compile times _much_
> longer").
> 
> And yet nobody has actually talked about why I *should* merge it.
> 
> Which - I think understandably - makes me less than enthusiastic.
> 
> So I think I'll let this wait a bit longer, _unless_ people start
> talking about the upsides. How much smaller is the end result? How
> much faster is it? How much more beautiful is it? Does it make new
> cool things possible? Are those cool things really close on the
> horizon and really want this merged even though it's not really quite
> ready yet?
> 
> So please: convince me.

I'd really like to see this feature go in to enable ongoing efforts to
make the kernel much smaller, so I'll give it a shot:

In addition to making the kernel smaller and such (I'll leave the
specific stats there to Andi), here's the key awesomeness of LTO that
you, personally, should find useful and compelling: LTO will eliminate
the need to add many lower-level Kconfig symbols to compile out bits of
the kernel.  Normally, compiling out a piece of kernel infrastructure
requires adding a kernel config symbol for that infrastructure, and
making all the other kernel bits that use that infrastructure depend on
it (which is an extra step beyond just "include the header and use it").
LTO will allow the compiler to automatically drop bits of infrastructure
(such as bits of lib/, kernel/, etc) that aren't used.

And with some additional GCC smarts (which exist today for C++ classes,
but would need adding for C structure-of-function-pointers objects), GCC
with LTO could even optimize away functions that are only used in the
function pointer of a data structure for which there are no callers.
So, it'd be possible to compile out high-level user-facing items like
syscalls, and have all the infrastructure go away all the way down.

So, with LTO merged, the next time you see a patch to add yet another
Kconfig symbol to compile out some low-level kernel infrastructure when
not needed, you can say "no, I don't want to add more configuration
complexity; compile out the high-level bits and use LTO to make the
compiler drop the infrastructure".  And we can potentially start ripping
out *existing* Kconfig infrastructure symbols like that, too.

- Josh Triplett

  reply	other threads:[~2014-04-08 20:49 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-07 20:19 [GIT] kbuild/lto changes for 3.15-rc1 Michal Marek
2014-04-07 20:59 ` Andi Kleen
2014-04-08 15:26 ` Linus Torvalds
2014-04-08 20:49   ` josh [this message]
2014-04-08 22:44     ` Linus Torvalds
2014-04-09  1:35       ` Andi Kleen
2014-04-09  6:01         ` Ingo Molnar
2014-04-09  8:17           ` Markus Trippelsdorf
2014-04-14 10:32             ` Ingo Molnar
2014-04-14 10:46               ` Markus Trippelsdorf
2014-04-14 10:55                 ` Ingo Molnar
2014-04-15  1:00               ` Josh Triplett
2014-04-15  1:52                 ` Andi Kleen
2014-04-15  6:00                 ` Ingo Molnar
2014-04-15  9:36                 ` Ralf Baechle
2014-04-15 11:19                   ` Sam Ravnborg
2014-04-15 11:36                     ` Markus Trippelsdorf
2014-04-15 18:19                       ` Sam Ravnborg
2014-04-15 18:29                         ` Markus Trippelsdorf
2014-04-16  6:49                           ` Ingo Molnar
2014-04-09 15:40           ` Andi Kleen
2014-04-08 22:49   ` Andi Kleen
2014-04-09  0:10     ` Jan Hubicka
2014-04-09  1:23       ` Andi Kleen
2014-04-09  0:14     ` Tim Bird

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=20140408204906.GA3616@cloud \
    --to=josh@joshtriplett.org \
    --cc=ak@linux.intel.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=torvalds@linux-foundation.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).