* [patch 01/2] allow gcc4 to control inlining
@ 2005-12-28 11:46 Ingo Molnar
2005-12-28 14:26 ` Matt Mackall
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Ingo Molnar @ 2005-12-28 11:46 UTC (permalink / raw)
To: lkml; +Cc: Linus Torvalds, Andrew Morton, Arjan van de Ven, Matt Mackall
allow gcc4 compilers to decide what to inline and what not - instead
of the kernel forcing gcc to inline all the time.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
----
include/linux/compiler-gcc4.h | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
Index: linux/include/linux/compiler-gcc4.h
===================================================================
--- linux.orig/include/linux/compiler-gcc4.h
+++ linux/include/linux/compiler-gcc4.h
@@ -3,14 +3,15 @@
/* These definitions are for GCC v4.x. */
#include <linux/compiler-gcc.h>
-#define inline inline __attribute__((always_inline))
-#define __inline__ __inline__ __attribute__((always_inline))
-#define __inline __inline __attribute__((always_inline))
+#define inline inline
+#define __inline__ __inline__
+#define __inline __inline
#define __deprecated __attribute__((deprecated))
#define __attribute_used__ __attribute__((__used__))
#define __attribute_pure__ __attribute__((pure))
#define __attribute_const__ __attribute__((__const__))
-#define noinline __attribute__((noinline))
+#define noinline __attribute__((noinline))
+#define __always_inline inline __attribute__((always_inline))
#define __must_check __attribute__((warn_unused_result))
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch 01/2] allow gcc4 to control inlining
2005-12-28 11:46 [patch 01/2] allow gcc4 to control inlining Ingo Molnar
@ 2005-12-28 14:26 ` Matt Mackall
2005-12-28 14:34 ` Ingo Molnar
2005-12-28 14:39 ` Roland Dreier
2005-12-28 18:39 ` Al Viro
2 siblings, 1 reply; 8+ messages in thread
From: Matt Mackall @ 2005-12-28 14:26 UTC (permalink / raw)
To: Ingo Molnar; +Cc: lkml, Linus Torvalds, Andrew Morton, Arjan van de Ven
On Wed, Dec 28, 2005 at 12:46:53PM +0100, Ingo Molnar wrote:
> allow gcc4 compilers to decide what to inline and what not - instead
> of the kernel forcing gcc to inline all the time.
>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> Signed-off-by: Arjan van de Ven <arjan@infradead.org>
I'm ever so slightly wary of GCC 4's stack size logic for functions with
nested scopes, but I think we'll have no trouble catching any trouble
cases in 2.6.16-rc.
Acked-by: Matt Mackall <mpm@selenic.com>
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch 01/2] allow gcc4 to control inlining
2005-12-28 14:26 ` Matt Mackall
@ 2005-12-28 14:34 ` Ingo Molnar
2005-12-28 14:36 ` Matt Mackall
0 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2005-12-28 14:34 UTC (permalink / raw)
To: Matt Mackall; +Cc: lkml, Linus Torvalds, Andrew Morton, Arjan van de Ven
* Matt Mackall <mpm@selenic.com> wrote:
> On Wed, Dec 28, 2005 at 12:46:53PM +0100, Ingo Molnar wrote:
> > allow gcc4 compilers to decide what to inline and what not - instead
> > of the kernel forcing gcc to inline all the time.
> >
> > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > Signed-off-by: Arjan van de Ven <arjan@infradead.org>
>
> I'm ever so slightly wary of GCC 4's stack size logic for functions
> with nested scopes, but I think we'll have no trouble catching any
> trouble cases in 2.6.16-rc.
>
> Acked-by: Matt Mackall <mpm@selenic.com>
FYI, the max function-frame size did not change, so there's no
outrageous frames like with gcc3, just a small shift upwards.
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch 01/2] allow gcc4 to control inlining
2005-12-28 14:34 ` Ingo Molnar
@ 2005-12-28 14:36 ` Matt Mackall
0 siblings, 0 replies; 8+ messages in thread
From: Matt Mackall @ 2005-12-28 14:36 UTC (permalink / raw)
To: Ingo Molnar; +Cc: lkml, Linus Torvalds, Andrew Morton, Arjan van de Ven
On Wed, Dec 28, 2005 at 03:34:42PM +0100, Ingo Molnar wrote:
>
> * Matt Mackall <mpm@selenic.com> wrote:
>
> > On Wed, Dec 28, 2005 at 12:46:53PM +0100, Ingo Molnar wrote:
> > > allow gcc4 compilers to decide what to inline and what not - instead
> > > of the kernel forcing gcc to inline all the time.
> > >
> > > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > > Signed-off-by: Arjan van de Ven <arjan@infradead.org>
> >
> > I'm ever so slightly wary of GCC 4's stack size logic for functions
> > with nested scopes, but I think we'll have no trouble catching any
> > trouble cases in 2.6.16-rc.
> >
> > Acked-by: Matt Mackall <mpm@selenic.com>
>
> FYI, the max function-frame size did not change, so there's no
> outrageous frames like with gcc3, just a small shift upwards.
My point is more that I wouldn't be surprised if we found a corner
case for a particular .config. But even with GCC 3 and 4k stacks,
automatic inlining worked just fine for most configs after killing
just a few offenders.
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch 01/2] allow gcc4 to control inlining
2005-12-28 11:46 [patch 01/2] allow gcc4 to control inlining Ingo Molnar
2005-12-28 14:26 ` Matt Mackall
@ 2005-12-28 14:39 ` Roland Dreier
2005-12-28 14:53 ` Ingo Molnar
2005-12-28 18:39 ` Al Viro
2 siblings, 1 reply; 8+ messages in thread
From: Roland Dreier @ 2005-12-28 14:39 UTC (permalink / raw)
To: Ingo Molnar
Cc: lkml, Linus Torvalds, Andrew Morton, Arjan van de Ven,
Matt Mackall
> -#define inline inline __attribute__((always_inline))
> -#define __inline__ __inline__ __attribute__((always_inline))
> -#define __inline __inline __attribute__((always_inline))
Why not just delete these lines? This:
> +#define inline inline
> +#define __inline__ __inline__
> +#define __inline __inline
seems pointless to me.
- R.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch 01/2] allow gcc4 to control inlining
2005-12-28 14:39 ` Roland Dreier
@ 2005-12-28 14:53 ` Ingo Molnar
0 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2005-12-28 14:53 UTC (permalink / raw)
To: Roland Dreier
Cc: lkml, Linus Torvalds, Andrew Morton, Arjan van de Ven,
Matt Mackall
* Roland Dreier <rdreier@cisco.com> wrote:
> > -#define inline inline __attribute__((always_inline))
> > -#define __inline__ __inline__ __attribute__((always_inline))
> > -#define __inline __inline __attribute__((always_inline))
>
> Why not just delete these lines? This:
>
> > +#define inline inline
> > +#define __inline__ __inline__
> > +#define __inline __inline
>
> seems pointless to me.
indeed. I thought they were redefined to a default if not defined, but
that's only the case for __always_inline. Updated patch below.
Ingo
--------
Subject: allow gcc4 to control inlining
allow gcc4 compilers to decide what to inline and what not - instead
of the kernel forcing gcc to inline all the time.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
----
include/linux/compiler-gcc4.h | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
Index: linux/include/linux/compiler-gcc4.h
===================================================================
--- linux.orig/include/linux/compiler-gcc4.h
+++ linux/include/linux/compiler-gcc4.h
@@ -3,14 +3,12 @@
/* These definitions are for GCC v4.x. */
#include <linux/compiler-gcc.h>
-#define inline inline __attribute__((always_inline))
-#define __inline__ __inline__ __attribute__((always_inline))
-#define __inline __inline __attribute__((always_inline))
#define __deprecated __attribute__((deprecated))
#define __attribute_used__ __attribute__((__used__))
#define __attribute_pure__ __attribute__((pure))
#define __attribute_const__ __attribute__((__const__))
-#define noinline __attribute__((noinline))
+#define noinline __attribute__((noinline))
+#define __always_inline inline __attribute__((always_inline))
#define __must_check __attribute__((warn_unused_result))
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch 01/2] allow gcc4 to control inlining
2005-12-28 11:46 [patch 01/2] allow gcc4 to control inlining Ingo Molnar
2005-12-28 14:26 ` Matt Mackall
2005-12-28 14:39 ` Roland Dreier
@ 2005-12-28 18:39 ` Al Viro
2005-12-28 19:51 ` Arjan van de Ven
2 siblings, 1 reply; 8+ messages in thread
From: Al Viro @ 2005-12-28 18:39 UTC (permalink / raw)
To: Ingo Molnar
Cc: lkml, Linus Torvalds, Andrew Morton, Arjan van de Ven,
Matt Mackall
On Wed, Dec 28, 2005 at 12:46:53PM +0100, Ingo Molnar wrote:
> allow gcc4 compilers to decide what to inline and what not - instead
> of the kernel forcing gcc to inline all the time.
> +#define noinline __attribute__((noinline))
> +#define __always_inline inline __attribute__((always_inline))
> #define __must_check __attribute__((warn_unused_result))
> #define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
You seem to be missing the rest of the patch - namely, addition of
always_inline where it is needed now...
Note that we *do* need it in quite a few places. Anything that relies on
dead code elimination to kill a call of function that doesn't exist
would better be always inlined...
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch 01/2] allow gcc4 to control inlining
2005-12-28 18:39 ` Al Viro
@ 2005-12-28 19:51 ` Arjan van de Ven
0 siblings, 0 replies; 8+ messages in thread
From: Arjan van de Ven @ 2005-12-28 19:51 UTC (permalink / raw)
To: Al Viro; +Cc: lkml
On Wed, 2005-12-28 at 18:39 +0000, Al Viro wrote:
> On Wed, Dec 28, 2005 at 12:46:53PM +0100, Ingo Molnar wrote:
> > allow gcc4 compilers to decide what to inline and what not - instead
> > of the kernel forcing gcc to inline all the time.
>
> > +#define noinline __attribute__((noinline))
> > +#define __always_inline inline __attribute__((always_inline))
> > #define __must_check __attribute__((warn_unused_result))
> > #define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
>
> You seem to be missing the rest of the patch - namely, addition of
> always_inline where it is needed now...
>
> Note that we *do* need it in quite a few places. Anything that relies on
> dead code elimination to kill a call of function that doesn't exist
> would better be always inlined...
on x86-64 that seems to only be fix_to_virt though.. so it's really not
that many.
(based on making "inline" a define for noinline and then an
allyesconfig)
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-12-28 19:52 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-28 11:46 [patch 01/2] allow gcc4 to control inlining Ingo Molnar
2005-12-28 14:26 ` Matt Mackall
2005-12-28 14:34 ` Ingo Molnar
2005-12-28 14:36 ` Matt Mackall
2005-12-28 14:39 ` Roland Dreier
2005-12-28 14:53 ` Ingo Molnar
2005-12-28 18:39 ` Al Viro
2005-12-28 19:51 ` Arjan van de Ven
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.