public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
To: Linus Torvalds
	<torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Cc: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Sam Ravnborg <sam-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>,
	Adrian Bunk <bunk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux arch <linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Subject: Re: [PATCH] prepare kconfig inline optimization for all architectures
Date: Sun, 27 Apr 2008 21:36:27 +0200	[thread overview]
Message-ID: <20080427193627.GA32654@elte.hu> (raw)
In-Reply-To: <alpine.LFD.1.10.0804271118500.2896-5CScLwifNT1QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>


* Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> wrote:

> I do obviously think that we're right to move into the direction that 
> "inline" should be a hint. In fact, the biggest issue I have with the 
> new kconfig option is that I think it should probably be 
> unconditional, but I suspect that compiler issues and architecture 
> issues make that not be a good idea.
> 
> It will take time before we've sorted out all the fall-out, because I 
> bet there is still code out there that _should_ use __always_inline, 
> but doesn't.

yeah, we i think had one such issue in x86 (merged upstream prior and 
independently of this feature iirc). We also know that something on 
powerpc doesnt work right out of box with inline being a hint. And 
that's OK and expected - for years we had "inline == always_inline" and 
there was just no force that moved against that. It was in fact 
surprising how well it all worked out on x86 when we reintroduced this 
feature.

btw., another new aspect of this whole area is that a number of major 
distributions now do CONFIG_CC_OPTIMIZE_FOR_SIZE=y in their kernels, and 
that seems to have brought new life into -Os development and with every 
new gcc generation we get denser and denser code generated. It is an 
interesting fact that generating good _small_ code needs a very good 
compiler that understands the code flow very accurately and is able to 
find the smallest possible representation for that.

A side-effect of that is if we do -Os _and_ turn inline into a hint via 
CONFIG_CC_OPTIMIZE_INLINING=y, gcc tends to do a better job than before. 
It cannot just go and inline stuff agressively in stark contrast to the 
-Os goal that was given to it. It still does not do a perfect job though 
- but now at least it has a _chance_ to improve. With always_inline we 
gave gcc no leeway at all.

a second aspect is that there's always the chance that some other 
compiler comes along that does things better than gcc. Again, with 
inline being a necessity we make it impossible for even sane compilers 
to do the right thing.

and a third aspect is that in the current -git kernel we have exactly 
11801 inlines in non-include files. Fighting the constant influx of them 
was a futile act 3 years ago when Arjan and me created this feature for 
the first time and it is futile today. It is a compiler domain problem 
and we should not waste any manpower "fighting" them. Life is too short :)

	Ingo

WARNING: multiple messages have this Message-ID (diff)
From: Ingo Molnar <mingo@elte.hu>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christoph Hellwig <hch@infradead.org>,
	Sam Ravnborg <sam@ravnborg.org>, Adrian Bunk <bunk@kernel.org>,
	linux arch <linux-arch@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	David Miller <davem@davemloft.net>
Subject: Re: [PATCH] prepare kconfig inline optimization for all architectures
Date: Sun, 27 Apr 2008 21:36:27 +0200	[thread overview]
Message-ID: <20080427193627.GA32654@elte.hu> (raw)
Message-ID: <20080427193627.88hhqxgN72hrelkIoFMGFASXcJBm4i-UWUOhNFApuQ0@z> (raw)
In-Reply-To: <alpine.LFD.1.10.0804271118500.2896@woody.linux-foundation.org>


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> I do obviously think that we're right to move into the direction that 
> "inline" should be a hint. In fact, the biggest issue I have with the 
> new kconfig option is that I think it should probably be 
> unconditional, but I suspect that compiler issues and architecture 
> issues make that not be a good idea.
> 
> It will take time before we've sorted out all the fall-out, because I 
> bet there is still code out there that _should_ use __always_inline, 
> but doesn't.

yeah, we i think had one such issue in x86 (merged upstream prior and 
independently of this feature iirc). We also know that something on 
powerpc doesnt work right out of box with inline being a hint. And 
that's OK and expected - for years we had "inline == always_inline" and 
there was just no force that moved against that. It was in fact 
surprising how well it all worked out on x86 when we reintroduced this 
feature.

btw., another new aspect of this whole area is that a number of major 
distributions now do CONFIG_CC_OPTIMIZE_FOR_SIZE=y in their kernels, and 
that seems to have brought new life into -Os development and with every 
new gcc generation we get denser and denser code generated. It is an 
interesting fact that generating good _small_ code needs a very good 
compiler that understands the code flow very accurately and is able to 
find the smallest possible representation for that.

A side-effect of that is if we do -Os _and_ turn inline into a hint via 
CONFIG_CC_OPTIMIZE_INLINING=y, gcc tends to do a better job than before. 
It cannot just go and inline stuff agressively in stark contrast to the 
-Os goal that was given to it. It still does not do a perfect job though 
- but now at least it has a _chance_ to improve. With always_inline we 
gave gcc no leeway at all.

a second aspect is that there's always the chance that some other 
compiler comes along that does things better than gcc. Again, with 
inline being a necessity we make it impossible for even sane compilers 
to do the right thing.

and a third aspect is that in the current -git kernel we have exactly 
11801 inlines in non-include files. Fighting the constant influx of them 
was a futile act 3 years ago when Arjan and me created this feature for 
the first time and it is futile today. It is a compiler domain problem 
and we should not waste any manpower "fighting" them. Life is too short :)

	Ingo

  parent reply	other threads:[~2008-04-27 19:36 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-27 10:51 [PATCH] prepare kconfig inline optimization for all architectures Sam Ravnborg
2008-04-27 10:51 ` Sam Ravnborg
     [not found] ` <20080427105100.GA14795-QabhHTsIXMSnlFQ6Q1D1Y0B+6BGkLq7r@public.gmane.org>
2008-04-27 11:31   ` Adrian Bunk
2008-04-27 11:31     ` Adrian Bunk
     [not found]     ` <20080427113158.GY2252-Aar9JVdAhcRoA3hw4S0G5QR5/fbUUdgG@public.gmane.org>
2008-04-27 11:56       ` Sam Ravnborg
2008-04-27 11:56         ` Sam Ravnborg
     [not found]         ` <20080427115603.GA23493-QabhHTsIXMSnlFQ6Q1D1Y0B+6BGkLq7r@public.gmane.org>
2008-04-27 12:36           ` Ingo Molnar
2008-04-27 12:36             ` Ingo Molnar
     [not found]             ` <20080427123642.GA28005-X9Un+BFzKDI@public.gmane.org>
2008-04-27 12:49               ` Ingo Molnar
2008-04-27 12:49                 ` Ingo Molnar
2008-04-27 17:06       ` Linus Torvalds
2008-04-27 17:06         ` Linus Torvalds
     [not found]         ` <alpine.LFD.1.10.0804271002360.2896-5CScLwifNT1QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
2008-04-27 17:22           ` Adrian Bunk
2008-04-27 17:22             ` Adrian Bunk
     [not found]             ` <20080427172235.GA2252-Aar9JVdAhcRoA3hw4S0G5QR5/fbUUdgG@public.gmane.org>
2008-04-27 17:32               ` Linus Torvalds
2008-04-27 17:32                 ` Linus Torvalds
     [not found]                 ` <alpine.LFD.1.10.0804271029130.2896-5CScLwifNT1QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
2008-04-27 17:47                   ` Adrian Bunk
2008-04-27 17:47                     ` Adrian Bunk
     [not found]                     ` <20080427174714.GB2252-Aar9JVdAhcRoA3hw4S0G5QR5/fbUUdgG@public.gmane.org>
2008-04-27 18:00                       ` Christoph Hellwig
2008-04-27 18:00                         ` Christoph Hellwig
     [not found]                         ` <20080427180007.GB28483-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2008-04-27 18:09                           ` Sam Ravnborg
2008-04-27 18:09                             ` Sam Ravnborg
     [not found]                             ` <20080427180957.GA25964-QabhHTsIXMSnlFQ6Q1D1Y0B+6BGkLq7r@public.gmane.org>
2008-04-27 18:14                               ` Christoph Hellwig
2008-04-27 18:14                                 ` Christoph Hellwig
     [not found]                                 ` <20080427181411.GA31667-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2008-04-27 18:24                                   ` Linus Torvalds
2008-04-27 18:24                                     ` Linus Torvalds
     [not found]                                     ` <alpine.LFD.1.10.0804271118500.2896-5CScLwifNT1QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
2008-04-27 18:32                                       ` Christoph Hellwig
2008-04-27 18:32                                         ` Christoph Hellwig
2008-04-27 19:36                                       ` Ingo Molnar [this message]
2008-04-27 19:36                                         ` Ingo Molnar
     [not found]                                         ` <20080427193627.GA32654-X9Un+BFzKDI@public.gmane.org>
2008-04-27 19:49                                           ` Adrian Bunk
2008-04-27 19:49                                             ` Adrian Bunk
2008-04-27 23:26                                       ` Arjan van de Ven
2008-04-27 23:26                                         ` Arjan van de Ven
     [not found]                                         ` <20080427162606.3dd82c0c-NIQFrBLA1CpScpXdPBN83iCwEArCW2h5@public.gmane.org>
2008-04-27 23:36                                           ` Linus Torvalds
2008-04-27 23:36                                             ` Linus Torvalds
     [not found]                                             ` <alpine.LFD.1.10.0804271634490.3119-5CScLwifNT1QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
2008-04-27 23:41                                               ` Ingo Molnar
2008-04-27 23:41                                                 ` Ingo Molnar
2008-04-27 18:31                                   ` Sam Ravnborg
2008-04-27 18:31                                     ` Sam Ravnborg
     [not found]                                     ` <20080427183131.GA26937-QabhHTsIXMSnlFQ6Q1D1Y0B+6BGkLq7r@public.gmane.org>
2008-04-27 18:36                                       ` Christoph Hellwig
2008-04-27 18:36                                         ` Christoph Hellwig
2008-04-27 18:11                       ` Linus Torvalds
2008-04-27 18:11                         ` Linus Torvalds
     [not found]                         ` <alpine.LFD.1.10.0804271053300.2896-5CScLwifNT1QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
2008-04-27 18:25                           ` Christoph Hellwig
2008-04-27 18:25                             ` Christoph Hellwig
     [not found]                             ` <20080427182544.GA23828-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2008-04-27 18:30                               ` Linus Torvalds
2008-04-27 18:30                                 ` Linus Torvalds
2008-04-27 18:41                           ` Adrian Bunk
2008-04-27 18:41                             ` Adrian Bunk
     [not found]                             ` <20080427184106.GD2252-Aar9JVdAhcRoA3hw4S0G5QR5/fbUUdgG@public.gmane.org>
2008-04-27 18:57                               ` Linus Torvalds
2008-04-27 18:57                                 ` Linus Torvalds
2008-04-27 20:51                       ` Mike Galbraith
2008-04-27 20:51                         ` Mike Galbraith
2008-04-27 17:57                   ` Christoph Hellwig
2008-04-27 17:57                     ` Christoph Hellwig
2008-04-27 17:40               ` Matthew Wilcox
2008-04-27 17:40                 ` Matthew Wilcox
     [not found]                 ` <20080427174055.GS14990-6jwH94ZQLHl74goWV3ctuw@public.gmane.org>
2008-04-27 17:59                   ` Adrian Bunk
2008-04-27 17:59                     ` Adrian Bunk

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=20080427193627.GA32654@elte.hu \
    --to=mingo-x9un+bfzkdi@public.gmane.org \
    --cc=bunk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sam-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org \
    --cc=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.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