mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@kernel.org>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Alexey Starikovskiy <aystarik@gmail.com>,
	lenb@kernel.org, astarikovskiy@suse.de,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [2.6 patch] acpi/battery.c: make 2 functions static
Date: Mon, 3 Mar 2008 11:48:59 +0200	[thread overview]
Message-ID: <20080303094859.GE4457@cs181133002.pp.htv.fi> (raw)
In-Reply-To: <20080303093103.GA23651@uranus.ravnborg.org>

On Mon, Mar 03, 2008 at 10:31:03AM +0100, Sam Ravnborg wrote:
> On Mon, Mar 03, 2008 at 10:17:14AM +0100, Ingo Molnar wrote:
> > 
> > * Adrian Bunk <bunk@kernel.org> wrote:
> > 
> > > On Mon, Mar 03, 2008 at 09:57:20AM +0100, Ingo Molnar wrote:
> > > > 
> > > > * Adrian Bunk <bunk@kernel.org> wrote:
> > > > 
> > > > > On Sat, Mar 01, 2008 at 09:26:41PM +0300, Alexey Starikovskiy wrote:
> > > > > > May I keep them inline?
> > > > > 
> > > > > The problem with such manual inlines is that we force gcc to always 
> > > > > inline them - and history has shown that functions grow without the 
> > > > > "inline" being removed.
> > > > 
> > > > what do you mean by "we force gcc to always inline them"?
> > > 
> > > #define inline          inline          __attribute__((always_inline))
> > > 
> > > > gcc is free to decide whether to inline or to not inline.
> > > 
> > > Not with __attribute__((always_inline)).
> > 
> > but that wasnt used in the code you patched:
> > 
> >   -inline int acpi_battery_present(struct acpi_battery *battery)
> >   +static int acpi_battery_present(struct acpi_battery *battery)
> 
> >From compiler-gcc.h:
> 
> #define inline          inline          __attribute__((always_inline))
> 
> So unless I am missing something obvious then each time we
> say inline to a function we require gcc to inline the function.

Exactly.

> It is my impression that today we only say inline if really needed
> and otherwise let gcc decide. So in almost all cases inlise should
> just be nuked?

The rule is:
- all static functions in headers should be marked inline
- no functions in .c files should be marked inline

For the latter there are a _few_ exceptions in hotpaths where doing so 
brings measurable advantages.

But generally (and especially long-term) it's best to let gcc decide 
which static functions in .c files should be inlined.

> 	Sam

cu
Adrian

-- 

       "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-03-03  9:50 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-01 16:19 Adrian Bunk
2008-03-01 18:26 ` Alexey Starikovskiy
2008-03-01 18:35   ` Adrian Bunk
2008-03-01 18:42     ` Alexey Starikovskiy
2008-03-01 18:45       ` Adrian Bunk
2008-03-03  8:57     ` Ingo Molnar
2008-03-03  9:13       ` Adrian Bunk
2008-03-03  9:17         ` Ingo Molnar
2008-03-03  9:31           ` Sam Ravnborg
2008-03-03  9:48             ` Adrian Bunk [this message]
2008-03-03 10:39             ` Ingo Molnar
2008-03-03 11:34               ` Adrian Bunk
2008-03-03 11:45                 ` Ingo Molnar
2008-03-03 12:02                   ` Adrian Bunk
2008-03-03 12:10                     ` Ingo Molnar
2008-03-03 12:29                       ` Adrian Bunk
2008-03-03 12:50                         ` Ingo Molnar
2008-03-03 14:54                           ` Adrian Bunk
2008-03-03 15:01                             ` Adrian Bunk
2008-03-04 13:16                             ` Ingo Molnar
2008-03-04 13:47                               ` Adrian Bunk
2008-03-04 14:22                                 ` Ingo Molnar
2008-03-04 14:36                                   ` Jörn Engel
2008-03-04 14:45                                     ` Ingo Molnar
2008-03-03 12:13                   ` [patch] x86: phase out forced inlining Ingo Molnar
2008-03-03 14:56                     ` Sam Ravnborg
2008-03-04 16:46                       ` Ingo Molnar
2008-03-04 18:07                         ` Harvey Harrison
2008-03-04 18:09                           ` H. Peter Anvin
2008-03-04 18:14                             ` Harvey Harrison
2008-03-04 18:18                             ` Harvey Harrison
2008-03-03 15:01                     ` Arjan van de Ven
2008-03-03 15:58                       ` Harvey Harrison
2008-03-04  6:42                     ` Andrew Morton
2008-03-04  7:32                       ` Ingo Molnar
2008-03-04  8:00                         ` Andrew Morton
2008-03-04  9:50                           ` Andi Kleen
2008-03-04  8:03                       ` Sam Ravnborg
2008-03-04  8:38                         ` Andrew Morton
2008-03-03  9:45           ` [2.6 patch] acpi/battery.c: make 2 functions static 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=20080303094859.GE4457@cs181133002.pp.htv.fi \
    --to=bunk@kernel.org \
    --cc=astarikovskiy@suse.de \
    --cc=aystarik@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sam@ravnborg.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

all inboxes | Powered by JetHome®