public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Hagen Paul Pfeifer <hagen@jauu.net>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: Borislav Petkov <bp@alien8.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH RFC] x86: enforce inlining for atomics
Date: Tue, 21 Apr 2015 09:42:12 +0200	[thread overview]
Message-ID: <20150421074212.GA25081@gmail.com> (raw)
In-Reply-To: <CAPh34mfe9FDLZ+cFBJQB1B8rBMwU_SpFHpp9nsH=a1jW=gN9+g@mail.gmail.com>


* Hagen Paul Pfeifer <hagen@jauu.net> wrote:

> On 20 April 2015 at 23:56, Borislav Petkov <bp@alien8.de> wrote:
> 
> > Hmm, that must be config-specific as doing
> >
> > objdump -D vmlinux | grep -i "atomic_add"
> >
> > here gives me only "drm_atomic_add_affected_connectors" matches.
> >
> > It probably gets inlined here always...
> 
> Probably, the config is allyesconfig minus trace/kernel adress 
> sanitizer and gcov related options.

So the thing is that allyesconfig turns on -Os:

   CONFIG_CC_OPTIMIZE_FOR_SIZE=y

which is known to make bad decisions in other areas as well ...

If -Os does such bad inlining decisions (and the inlining examples you 
cited are horrible!) then I guess a lot of the other 'inline' 
functions are handled by it badly as well.

I'm not sure we should start fighting the compiler: if a compiler does 
not take 'inline' seriously then the solution is to use another 
compiler, or at least to use different compiler flags.

If inlining decisions are bad even with saner compiler options then we 
can use __always_inline, and we actually do that for locking 
primitives and some other low level primitives: which are typically 
larger than atomics, so even reasonable compilers might uninline them.

But I'm not against your patch either. Linus, what's your preference?

Thanks,

	Ingo

  reply	other threads:[~2015-04-21  7:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-20 21:27 [PATCH RFC] x86: enforce inlining for atomics Hagen Paul Pfeifer
2015-04-20 21:56 ` Borislav Petkov
2015-04-20 22:08   ` Hagen Paul Pfeifer
2015-04-21  7:42     ` Ingo Molnar [this message]
2015-04-21 10:56       ` Hagen Paul Pfeifer
2015-04-21 22:57       ` Hagen Paul Pfeifer
2015-04-22  0:57         ` Linus Torvalds
2015-04-22  5:24         ` Markus Trippelsdorf
2015-04-22  5:58           ` Hagen Paul Pfeifer
2015-04-22  9:20             ` Markus Trippelsdorf
2015-04-22  9:28               ` Ingo Molnar
2015-04-22  9:31                 ` Hagen Paul Pfeifer
2015-04-30  1:52                   ` Henrique de Moraes Holschuh
2015-07-13 18:27                 ` Denys Vlasenko
2015-07-13 19:20                   ` Hagen Paul Pfeifer
2015-07-13 21:06                     ` Denys Vlasenko
2015-07-13 21:12                       ` Hagen Paul Pfeifer
2015-07-13 18:25               ` Denys Vlasenko
2015-04-20 23:46 ` Peter Zijlstra
2015-04-22 14:10 ` [tip:x86/asm] x86/asm: Always inline atomics tip-bot for Hagen Paul Pfeifer

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=20150421074212.GA25081@gmail.com \
    --to=mingo@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=hagen@jauu.net \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --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