linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Christoph Lameter <cl@linux.com>
Cc: Austin S Hemmelgarn <ahferroin7@gmail.com>,
	sedat.dilek@gmail.com, Peter Zijlstra <peterz@infradead.org>,
	Baoquan He <bhe@redhat.com>, Denys Vlasenko <dvlasenk@redhat.com>,
	Tejun Heo <tj@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Rientjes <rientjes@google.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>, Thomas Graf <tgraf@suug.ch>,
	the arch/x86 maintainers <x86@kernel.org>
Subject: Re: [llvmlinux] percpu | bitmap issue? (Cannot boot on bare metal due to a kernel NULL pointer dereference)
Date: Tue, 15 Sep 2015 08:11:02 +0200	[thread overview]
Message-ID: <20150915061102.GA20229@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1509141325460.4192@east.gentwo.org>


* Christoph Lameter <cl@linux.com> wrote:

> On Mon, 14 Sep 2015, Austin S Hemmelgarn wrote:
> 
> >I can comment at least a little about the -Os aspect (although not I'm no
> >expert on this in particular).  In general, for _most_ use cases, a kernel
> >compiled with CONFIG_CC_OPTIMIZE_FOR_SIZE will run slower than one compiled
> >without it.  On rare occasion though, it may actually run faster, the only
> >cases I've seen where this happens are specialized uses that are very memory
> >pressure dependent and run almost entirely in userspace with almost no
> >syscalls (for example math related stuff operating on _very, very big_ (as in,
> >>1 trillion elements) multidimensional matrices, with complex memory
> >constraints), and even then it's usually a miniscule improvement in
> >performance (generally less than 1%, which can of course be significant
> >depending on how long it takes before the improvement).
> 
> Cache footprint depends on size which has a significant impact on
> performance. In our experience the kernel (and any other code) is
> generally faster if optimized for size.

Unfortunately, GCC overdoes -Os generating outright silly code, which makes the 
result generally slower - despite the reduced instruction count and reduced cache 
footprint.

We've recently applied patches to the x86 tree that give us a good chunk of the 
size savings that -Os brings:

  52648e83c9a6 x86: Pack loops tightly as well
  be6cb02779ca x86: Align jump targets to 1-byte boundaries

these two shave about 5% off from the typical distro kernel's size. That's still 
way off the 15%-20% that -Os can muster, but another ~10% are possible by not 
aligning functions to byte boundaries (instead of the default 16 bytes).

So about 70% of the -Os size win is from simple and pure alignment relaxation, not 
from any deeper compiler optimizations.

So LLVM could emulate most of the good effects of -Os by only compressing the 
various alignment parameters - and this would be a pretty safe optimization as 
well.

Thanks,

	Ingo

      parent reply	other threads:[~2015-09-15  6:11 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-06 17:45 [llvmlinux] percpu | bitmap issue? (Cannot boot on bare metal due to a kernel NULL pointer dereference) Sedat Dilek
2015-09-07  5:58 ` Sedat Dilek
     [not found]   ` <CA+icZUUs3KEydWRgu_Y+YqS4TcCNp2DUw3Y+KfBzX7aPg_kzLw@mail.gmail.com>
2015-09-09  2:29     ` Baoquan He
2015-09-09  2:51       ` Sedat Dilek
2015-09-09  3:04         ` Sedat Dilek
2015-09-09  3:14           ` Sedat Dilek
2015-09-09  3:25         ` Baoquan He
2015-09-09  3:46           ` Sedat Dilek
2015-09-09  6:56             ` Sedat Dilek
2015-09-09  7:14               ` Baoquan He
2015-09-09  7:41                 ` Sedat Dilek
2015-09-09 10:05                   ` Sedat Dilek
2015-09-09 12:54                     ` Peter Zijlstra
2015-09-12 21:22                       ` Sedat Dilek
2015-09-13  2:33                         ` Sedat Dilek
2015-09-14  7:12                           ` Peter Zijlstra
2015-09-14  7:35                             ` Sedat Dilek
2015-09-14  7:57                               ` Sedat Dilek
2015-09-14  8:54                               ` Peter Zijlstra
2015-09-14  9:35                                 ` Ingo Molnar
2015-09-14  9:55                                   ` Sedat Dilek
2015-09-14  9:59                                     ` Ingo Molnar
2015-09-14 10:22                                       ` Sedat Dilek
2015-09-14 12:47                                         ` Ingo Molnar
2015-09-14  7:49                             ` Sedat Dilek
2015-09-14 17:50                               ` Austin S Hemmelgarn
2015-09-14 18:27                                 ` Christoph Lameter
2015-09-14 18:38                                   ` Austin S Hemmelgarn
2015-09-15  6:11                                   ` Ingo Molnar [this message]

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=20150915061102.GA20229@gmail.com \
    --to=mingo@kernel.org \
    --cc=ahferroin7@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=cl@linux.com \
    --cc=dvlasenk@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rientjes@google.com \
    --cc=sedat.dilek@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=tgraf@suug.ch \
    --cc=tj@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).