public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Sam Ravnborg <sam@ravnborg.org>,
	linux arch <linux-arch@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
	David Miller <davem@davemloft.net>
Subject: Re: [PATCH] prepare kconfig inline optimization for all architectures
Date: Sun, 27 Apr 2008 20:22:35 +0300	[thread overview]
Message-ID: <20080427172235.GA2252@cs181133002.pp.htv.fi> (raw)
In-Reply-To: <alpine.LFD.1.10.0804271002360.2896@woody.linux-foundation.org>

On Sun, Apr 27, 2008 at 10:06:41AM -0700, Linus Torvalds wrote:
> 
> 
> On Sun, 27 Apr 2008, Adrian Bunk wrote:
> > 
> > My opinion on this is still:
> > "OPTIMIZE" means "work around bugs in the kernel".
> 
> No.
> 
> It means that
> 
>  - gcc used to (long ago) always honor "inline", and we had kernel code 
>    that depended on that in various ways (ie required that there was no 
>    return etc).
> 
>    We've been mostly replacing the ones we know about with 
>    "__always_inline", but there may be some that remain. We'll find out, I 
>    guess.
> 
>  - gcc was a total and utter piece of horrible crap in the inlining 
>    department, doign insane things and changing their documentation to 
>    match the new behaviour (and some people then claimed that it was 
>    always documented that way).
> 
>    It would not inline big functions even when they statically collapsed 
>    to nothing, etc.
> 
> As a result, we really couldn't afford to let gcc make any inlining 
> decisions, because the compiler was simply *broken*.

I'm looking at it from a different angle, all code in the kernel should 
follow the following rules [1]:
- no functions in .c files should be marked inline
- all functions in headers should be static inline
- all functions in headers should either be very small or collapse
  to become very small after inlining

I can simply not see any usecase for a non-forced inline in the kernel,
and fixing the kernel should give a superset of the space savings of 
this "inline optimization".

> 			Linus

cu
Adrian

[1] there might be rare exceptions

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


  reply	other threads:[~2008-04-27 17:23 UTC|newest]

Thread overview: 30+ 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 11:31 ` Adrian Bunk
2008-04-27 11:56   ` Sam Ravnborg
2008-04-27 12:36     ` Ingo Molnar
2008-04-27 12:49       ` Ingo Molnar
2008-04-27 17:06   ` Linus Torvalds
2008-04-27 17:22     ` Adrian Bunk [this message]
2008-04-27 17:32       ` Linus Torvalds
2008-04-27 17:47         ` Adrian Bunk
2008-04-27 18:00           ` Christoph Hellwig
2008-04-27 18:09             ` Sam Ravnborg
2008-04-27 18:14               ` Christoph Hellwig
2008-04-27 18:24                 ` Linus Torvalds
2008-04-27 18:32                   ` Christoph Hellwig
2008-04-27 19:36                   ` Ingo Molnar
2008-04-27 19:49                     ` Adrian Bunk
2008-04-27 23:26                   ` Arjan van de Ven
2008-04-27 23:36                     ` Linus Torvalds
2008-04-27 23:41                       ` Ingo Molnar
2008-04-27 18:31                 ` Sam Ravnborg
2008-04-27 18:36                   ` Christoph Hellwig
2008-04-27 18:11           ` Linus Torvalds
2008-04-27 18:25             ` Christoph Hellwig
2008-04-27 18:30               ` Linus Torvalds
2008-04-27 18:41             ` Adrian Bunk
2008-04-27 18:57               ` Linus Torvalds
2008-04-27 20:51           ` Mike Galbraith
2008-04-27 17:57         ` Christoph Hellwig
2008-04-27 17:40       ` Matthew Wilcox
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=20080427172235.GA2252@cs181133002.pp.htv.fi \
    --to=bunk@kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sam@ravnborg.org \
    --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