linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Pitre <nicolas.pitre@linaro.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	Nicholas Piggin <npiggin@gmail.com>,
	linux-arch <linux-arch@vger.kernel.org>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	X86 ML <x86@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Paul Burton <paul.burton@imgtec.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC PATCH] x86: enable dead code and data elimination (LTO)
Date: Sun, 9 Jul 2017 09:59:44 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.20.1707090946090.1959@knanqh.ubzr> (raw)
In-Reply-To: <CAK7LNAR-VF2o3-qcCXnkath_B74KQodh_vezPRErGPhZSao2VA@mail.gmail.com>

On Sun, 9 Jul 2017, Masahiro Yamada wrote:

> Hi.
> 
> 2017-07-09 18:05 GMT+09:00 Ingo Molnar <mingo@kernel.org>:
> >
> > * Nicholas Piggin <npiggin@gmail.com> wrote:
> >
> >> FYI, easiest way to check if you forgot to KEEP a linker table is
> >> to look at `readelf -S vmlinux` differences, and to see what is
> >> being trimmed, look at nm differences or use --print-gc-sections
> >> LD option to see what symbols you're trimming. Linker tables,
> >> boot entry, and exception entry tends to require anchoring.
> >
> > Could you please add a debug build target to display all discarded
> > symbols/sections? Something like:
> >
> >         make lto-check
> >
> > ... or so?
> >
> > Thanks,
> >
> >         Ingo
> 
> 
> Actually, LTO activity existed some years ago
> (but not pulled in).
> 
> http://www.spinics.net/lists/linux-kbuild/msg09242.html
> 
> 
> IIUC, this patch enables "dead code elimination",
> (or "garbage collection"?),
> but I think it is different from what is called LTO.

Yes, it is different.  With gc-sections the linker simply drops code 
sections that have no references to them. This is therefore fast and low 
complexity.  LTO postpones the compiler's code optimization passes at 
the point where everything is linked together and can do things like 
constant propagation across multiple files, etc. LTO is therefore more 
efficient at removing unused code but compilation time is much longer 
due to the added complexity and inherent difficulty to parallelize the 
operation across multiple CPUS.

I think we should aim for gc-sections to be used by default and have LTO 
as a possible option only.


Nicolas

  reply	other threads:[~2017-07-09 13:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-09  3:13 [RFC PATCH] x86: enable dead code and data elimination (LTO) Nicholas Piggin
2017-07-09  9:05 ` Ingo Molnar
2017-07-09 13:29   ` Masahiro Yamada
2017-07-09 13:59     ` Nicolas Pitre [this message]
2017-07-10  2:13       ` Nicholas Piggin
2017-07-12 16:29         ` Andi Kleen
2017-07-12 17:34           ` Nicolas Pitre
2017-07-13  2:51           ` Nicholas Piggin

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=alpine.LFD.2.20.1707090946090.1959@knanqh.ubzr \
    --to=nicolas.pitre@linaro.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=hpa@zytor.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=npiggin@gmail.com \
    --cc=paul.burton@imgtec.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    --cc=yamada.masahiro@socionext.com \
    /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).