linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Optimized inlining for ARM
@ 2010-11-24 23:56 Stephen Boyd
  2010-11-24 23:56 ` [PATCH 1/2] Make OPTIMIZE_INLINING a generic option Stephen Boyd
  2010-11-24 23:57 ` [PATCH 2/2] arm: add optimized inlining Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Boyd @ 2010-11-24 23:56 UTC (permalink / raw)
  To: linux-arm-kernel

I know that Ingo deliberately introduced this option as x86
specific, but I'd like to introduce this for ARM as well. To
avoid useless copy paste, I've made the option generic so
any arch can support it.

In an effort to make a tiny crash kernel this option can shave a
few kb off the crash kernel size. It also helps a regular kernel
have a smaller icache footprint which should be benficial.
This option isn't on by default so there is no harm in adding it
besides giving the user a potentially dangerous option to enable.
If it's really experimental we can add an "if EXPERIMENTAL" in the
second patch. In the end, I'd like to get a wider range of testing with
this feature enabled on ARM so I'm posting it here in hopes that
people can respond back with Tested-by tags (or Naks if it crashes their
system).

Stephen Boyd (2):
  Make OPTIMIZE_INLINING a generic option
  arm: add optimized inlining

 arch/arm/Kconfig       |    1 +
 arch/x86/Kconfig       |    4 +---
 arch/x86/Kconfig.debug |   14 --------------
 init/Kconfig           |   18 ++++++++++++++++++
 4 files changed, 20 insertions(+), 17 deletions(-)

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] Make OPTIMIZE_INLINING a generic option
  2010-11-24 23:56 [PATCH 0/2] Optimized inlining for ARM Stephen Boyd
@ 2010-11-24 23:56 ` Stephen Boyd
  2010-11-24 23:57 ` [PATCH 2/2] arm: add optimized inlining Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2010-11-24 23:56 UTC (permalink / raw)
  To: linux-arm-kernel

This option is useful on more architectures than just x86. When
this option was introduced Ingo deliberately made it x86
specific since he was uncertain of the amount of testing other
architectures had (see http://lkml.org/lkml/2008/3/4/285).

This option has been tested on ARM v7 with no ill effects observed.
Therefore make it generic so ARM can choose it in the next patch.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/x86/Kconfig       |    4 +---
 arch/x86/Kconfig.debug |   14 --------------
 init/Kconfig           |   18 ++++++++++++++++++
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index e832768..292b64c 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -65,6 +65,7 @@ config X86
 	select HAVE_SPARSE_IRQ
 	select GENERIC_IRQ_PROBE
 	select GENERIC_PENDING_IRQ if SMP
+	select ARCH_SUPPORTS_OPTIMIZED_INLINING
 
 config INSTRUCTION_DECODER
 	def_bool (KPROBES || PERF_EVENTS)
@@ -193,9 +194,6 @@ config AUDIT_ARCH
 	bool
 	default X86_64
 
-config ARCH_SUPPORTS_OPTIMIZED_INLINING
-	def_bool y
-
 config ARCH_SUPPORTS_DEBUG_PAGEALLOC
 	def_bool y
 
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index b59ee76..5e714f3 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -265,20 +265,6 @@ config CPA_DEBUG
 	---help---
 	  Do change_page_attr() self-tests every 30 seconds.
 
-config OPTIMIZE_INLINING
-	bool "Allow gcc to uninline functions marked 'inline'"
-	---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
-	  enabling this option will generate a smaller kernel there. Hopefully
-	  this algorithm is so good that allowing gcc 4.x and above to make the
-	  decision will become the default in the future. Until then this option
-	  is there to test gcc for this.
-
-	  If unsure, say N.
-
 config DEBUG_STRICT_USER_COPY_CHECKS
 	bool "Strict copy size checks"
 	depends on DEBUG_KERNEL && !TRACE_BRANCH_PROFILING
diff --git a/init/Kconfig b/init/Kconfig
index 88c1046..d8b2c50 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -811,6 +811,24 @@ config CC_OPTIMIZE_FOR_SIZE
 
 	  If unsure, say Y.
 
+config ARCH_SUPPORTS_OPTIMIZED_INLINING
+	bool
+
+config OPTIMIZE_INLINING
+	bool "Allow gcc to uninline functions marked 'inline'"
+	depends on ARCH_SUPPORTS_OPTIMIZED_INLINING
+	---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 enabling this option will generate a smaller
+	  kernel there. Hopefully this algorithm is so good that allowing gcc
+	  4.x and above to make the decision will become the default in the
+	  future. Until then this option is there to test gcc for this.
+
+	  If unsure, say N.
+
 config SYSCTL
 	bool
 
-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] arm: add optimized inlining
  2010-11-24 23:56 [PATCH 0/2] Optimized inlining for ARM Stephen Boyd
  2010-11-24 23:56 ` [PATCH 1/2] Make OPTIMIZE_INLINING a generic option Stephen Boyd
@ 2010-11-24 23:57 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2010-11-24 23:57 UTC (permalink / raw)
  To: linux-arm-kernel

This patch is inspired by 60a3cdd (x86: add optimized inlining,
2008-03-03). GCC is currently being forced to inline whatever
functions are marked as inline (due to the #define of inline to
the gcc attribute always_inline). The 4.x series of GCC has a
rewritten inlining algorithm which should be good enough for the
kernel's purposes. Enabling this option will allow GCC to decide
when to inline a function marked as inline. Since it's opt-in and
doesn't affect functions marked as always_inline there shouldn't
be much harm in allowing people to enable this. If there is, we
should find the affected functions and mark them as always_inline.

	text    data     bss     dec     hex filename
	5987182  246104  926696 7159982  6d40ae vmlinux.orig
	5794190  246104  926744 6967038  6a4efe vmlinux.new

It reduces the text section of my kernel by 3.3%, which is pretty
nice.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index db524e7..1ed7968 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -23,6 +23,7 @@ config ARM
 	select PERF_USE_VMALLOC
 	select HAVE_REGS_AND_STACK_ACCESS_API
 	select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V7))
+	select ARCH_SUPPORTS_OPTIMIZED_INLINING
 	help
 	  The ARM series is a line of low-power-consumption RISC chip designs
 	  licensed by ARM Ltd and targeted at embedded applications and
-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-24 23:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-24 23:56 [PATCH 0/2] Optimized inlining for ARM Stephen Boyd
2010-11-24 23:56 ` [PATCH 1/2] Make OPTIMIZE_INLINING a generic option Stephen Boyd
2010-11-24 23:57 ` [PATCH 2/2] arm: add optimized inlining Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).