Re: [patch 7/7] Make "inline" no longer mandatory for gcc 4.x

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2006-01-06 at 12:31 -0500, Jeff Garzik wrote:
> Arjan van de Ven wrote:
> > Subject: when CONFIG_CC_OPTIMIZE_FOR_SIZE, allow gcc4 to control inlining
> > From: Ingo Molnar <[email protected]>
> > 
> > if optimizing for size (CONFIG_CC_OPTIMIZE_FOR_SIZE), allow gcc4 compilers
> > to decide what to inline and what not - instead of the kernel forcing gcc
> > to inline all the time. This requires several places that require to be 
> > inlined to be marked as such, previous patches in this series do that.
> > This is probably the most flame-worthy patch of the series.
> > 
> > Signed-off-by: Ingo Molnar <[email protected]>
> > Signed-off-by: Arjan van de Ven <[email protected]>
> 
> NAK, for what it's worth...  This should be first integrated with its 
> own "off switch", and then later added to optimze-for-size.

at the same time I'd not want such a config option to linger around
forever; if we do one config option per patch it gets unmanagable.
How about this?





if optimizing for size (CONFIG_CC_OPTIMIZE_FOR_SIZE), allow gcc4 compilers
to decide what to inline and what not - instead of the kernel forcing gcc
to inline all the time. This requires several places that require to be 
inlined to be marked as such, previous patches in this series do that.


Signed-off-by: Arjan van de Ven <[email protected]>

----

 include/linux/compiler-gcc4.h |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

Index: linux-2.6.15/include/linux/compiler-gcc4.h
===================================================================
--- linux-2.6.15.orig/include/linux/compiler-gcc4.h
+++ linux-2.6.15/include/linux/compiler-gcc4.h
@@ -3,9 +3,11 @@
 /* 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))
+#ifdef CONFIG_FORCED_INLINING
+# define inline			inline		__attribute__((always_inline))
+# define __inline__		__inline__	__attribute__((always_inline))
+# define __inline		__inline	__attribute__((always_inline))
+#endif
 #define __always_inline		inline __attribute__((always_inline))
 #define __deprecated		__attribute__((deprecated))
 #define __attribute_used__	__attribute__((__used__))
Index: linux-2.6.15/lib/Kconfig.debug
===================================================================
--- linux-2.6.15.orig/lib/Kconfig.debug
+++ linux-2.6.15/lib/Kconfig.debug
@@ -186,6 +186,20 @@ config FRAME_POINTER
 	  some architectures or if you use external debuggers.
 	  If you don't debug the kernel, you can say N.
 
+config FORCED_INLINING
+	bool "Force gcc to inline functions marked 'inline'"
+	depends on DEBUG_KERNEL
+	default y
+	help
+	  This option determines if the kernel forces gcc to inline the functions
+	  developers have marked 'inline'. Doing so takes away freedom from gcc to
+	  do what it thinks is best, which is desirable for the gcc 3.x series of
+	  compilers. The gcc 4.x series have a rewritten inlining algorithm and
+	  disabling this option will generate a smaller kernel there. Hopefully
+	  this algorithm is so good that allowing gcc4 to make the decision can
+	  become the default in the future, until then this option is there to
+	  test gcc for this.
+
 config RCU_TORTURE_TEST
 	tristate "torture tests for RCU"
 	depends on DEBUG_KERNEL
Index: linux-2.6.15/Documentation/feature-removal-schedule.txt
===================================================================
--- linux-2.6.15.orig/Documentation/feature-removal-schedule.txt
+++ linux-2.6.15/Documentation/feature-removal-schedule.txt
@@ -143,6 +143,15 @@ Who:	Christoph Hellwig <[email protected]>
 
 ---------------------------
 
+What:	CONFIG_FORCED_INLINING
+When:	June 2006
+Why:	Config option is there to see if gcc is good enough. (in january
+        2006). If it is, the behavior should just be the default. If it's not,
+	the option should just go away entirely.
+Who:    Arjan van de Ven  <[email protected]>
+
+---------------------------
+
 What:	START_ARRAY ioctl for md
 When:	July 2006
 Files:	drivers/md/md.c


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux