From: Arjan van de Ven <arjan@linux.intel.com>
To: linux-kernel@vger.kernel.org, torvalds@osdl.org
Cc: akpm@osdl.org, ak@suse.de
Subject: [Patch 4/4] Tell GCC 4.1 to move unlikely() code to a separate section
Date: Mon, 27 Feb 2006 16:31:24 +0100 [thread overview]
Message-ID: <1141054284.2992.136.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <1141053825.2992.125.camel@laptopd505.fenrus.org>
This patch is more controversial I assume; it offers the option
to use the gcc 4.1 option to move unlikely() code to a separate section.
On the con side, this means that longer byte sequences are needed to jump
to this code, on the Pro side it means that the unlikely() code isn't sharing
icache cachelines and tlbs anymore.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
arch/x86_64/Kconfig.debug | 10 ++++++++++
arch/x86_64/Makefile | 4 ++++
2 files changed, 14 insertions(+)
Index: linux-reorder2/arch/x86_64/Kconfig.debug
===================================================================
--- linux-reorder2.orig/arch/x86_64/Kconfig.debug
+++ linux-reorder2/arch/x86_64/Kconfig.debug
@@ -12,6 +12,16 @@ config DEBUG_RODATA
of the kernel code won't be covered by a 2MB TLB anymore.
If in doubt, say "N".
+config REORDER_BLOCKS
+ bool "Enable gcc to move unlikely() code away"
+ depends on DEBUG_KERNEL
+ help
+ This option will enable gcc 4.1 and later to reorder code that is
+ marked unlikely() far away from the code to the end of the kernel
+ image. This allows the processor to make better use of the instruction
+ cache, however it also makes OOPses harder to decode.
+ If in doubt, say "N"
+
config IOMMU_DEBUG
depends on GART_IOMMU && DEBUG_KERNEL
bool "Enable IOMMU debugging"
Index: linux-reorder2/arch/x86_64/Makefile
===================================================================
--- linux-reorder2.orig/arch/x86_64/Makefile
+++ linux-reorder2/arch/x86_64/Makefile
@@ -47,6 +47,10 @@ ifneq ($(CONFIG_DEBUG_INFO),y)
# -fweb shrinks the kernel a bit, but the difference is very small
# it also messes up debugging, so don't use it for now.
#CFLAGS += $(call cc-option,-fweb)
+# -freorder-blocks-and-partition moves all unlikely() code out of the
+# way, to increase icache density of the hot codepaths.
+# this makes oopses harder to read as well, so it's a config option
+cflags-$(CONFIG_REORDER_BLOCKS) += $(call cc-option,-freorder-blocks-and-partition)
endif
# -funit-at-a-time shrinks the kernel .text considerably
# unfortunately it makes reading oopses harder.
next prev parent reply other threads:[~2006-02-27 15:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-27 15:23 [Patch 0/4] Reordering of functions, try 2 Arjan van de Ven
2006-02-27 15:27 ` [Patch 2/4] Basic reorder infrastructure Arjan van de Ven
2006-02-27 15:41 ` Andi Kleen
2006-02-27 16:31 ` sam
2006-02-27 17:19 ` Arjan van de Ven
2006-02-28 19:08 ` Sam Ravnborg
2006-03-10 9:45 ` [Patch 2/4] Basic reorder infrastructure - makes linking very slow Andi Kleen
2006-02-27 15:31 ` Arjan van de Ven [this message]
2006-02-27 15:39 ` [Patch 4/4] Tell GCC 4.1 to move unlikely() code to a separate section Andi Kleen
2006-02-27 23:33 ` Bill Davidsen
2006-02-27 15:31 ` [Patch 3/4] Move the base kernel to 2Mb to align with TLB boundaries Arjan van de Ven
2006-02-27 15:36 ` Andi Kleen
2006-02-27 15:52 ` Arjan van de Ven
2006-02-27 15:31 ` [Patch 1/4] avoid entry.S functions from reordering Arjan van de Ven
2006-02-27 15:36 ` [Patch 0/4] Reordering of functions, try 2 Andi Kleen
2006-02-27 15:43 ` Arjan van de Ven
2006-02-28 6:34 [Patch 4/4] Tell GCC 4.1 to move unlikely() code to a separate section Chuck Ebbert
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=1141054284.2992.136.camel@laptopd505.fenrus.org \
--to=arjan@linux.intel.com \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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®