From: Alexey Dobriyan <adobriyan@gmail.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Linus Torvalds <torvalds@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>, Andy Lutomirski <luto@kernel.org>
Subject: Re: FYI -ffreestanding shrinks kernel by 2% on x86_64
Date: Sun, 12 May 2019 20:55:54 +0300 [thread overview]
Message-ID: <20190512175554.GA10777@avx2> (raw)
In-Reply-To: <20190512093228.GA8088@gmail.com>
On Sun, May 12, 2019 at 11:32:28AM +0200, Ingo Molnar wrote:
>
> * Alexey Dobriyan <adobriyan@gmail.com> wrote:
>
> > On Sat, May 11, 2019 at 11:02:24PM +0300, Alexey Dobriyan wrote:
> > > I compiled current F29 kernel config on x86_64 (5.0.13-200.fc29.x86_64)
> > > with -ffreestanding. The results are interesting :^):
> > >
> > > add/remove: 30/22 grow/shrink: 1290/46867 up/down: 33658/-1778055 (-1744397)
> > > Total: Before=83298859, After=81554462, chg -2.09% (!)
> > >
> > > That's original config with modules compiled built-in.
> >
> > Argh, it's the other way: adding -ffreestanding shrinks kernel by 2%.
>
> This is a very interesting finding, as we've seen numerous code
> generation artifacts from GCC assuming libgcc things.
>
> Has anyone investigated by any chance where the -ffreestanding space
> savings come from mostly - is it mostly in cold paths, or does it make or
> hot codepaths more efficient as well?
>
> If it's the latter then the kernel would be directly faster as well
> (fewer instructions executed), not just indirectly from better cache
> packing, I suppse?
Turns out -ffreestanding completely disables stack protector :-\
F29 83298859
-ffreestanding -1744397 -2.09%
STACKPROTECTOR_STRONG=n -1369949 -1.64%
Builtin function are in noise, e.g -fno-builtin-sprintf is only -14KB.
next prev parent reply other threads:[~2019-05-12 17:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-11 20:02 FYI -ffreestanding bloats kernel by 2% on x86_64 Alexey Dobriyan
2019-05-11 20:13 ` FYI -ffreestanding shrinks " Alexey Dobriyan
2019-05-12 9:32 ` Ingo Molnar
2019-05-12 17:55 ` Alexey Dobriyan [this message]
2019-05-13 9:13 ` David Laight
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=20190512175554.GA10777@avx2 \
--to=adobriyan@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.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