[patch 15/26] Immediate Values - Kconfig menu in EMBEDDED

Mathieu Desnoyers
2008-01-24T20:40:05Z

[-- Attachment #1: immediate-values-kconfig-embedded.patch --]
[-- Type: text/plain, Size: 2670 bytes --]

Immediate values provide a way to use dynamic code patching to update variables
sitting within the instruction stream. It saves caches lines normally used by
static read mostly variables. Enable it by default, but let users disable it
through the EMBEDDED menu with the "Disable immediate values" submenu entry.

Note: Since I think that I really should let embedded systems developers using
RO memory the option to disable the immediate values, I choose to leave this
menu option there, in the EMBEDDED menu. Also, the "CONFIG_IMMEDIATE" makes
sense because we want to compile out all the immediate code when we decide not
to use optimized immediate values at all (it removes otherwise unused code).

Changelog:
- Change ARCH_SUPPORTS_IMMEDIATE for ARCH_HAS_IMMEDIATE

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: Rusty Russell <rusty@rustcorp.com.au>
CC: Adrian Bunk <bunk@stusta.de>
CC: Andi Kleen <andi@firstfloor.org>
CC: Alexey Dobriyan <adobriyan@gmail.com>
CC: Christoph Hellwig <hch@infradead.org>
---
init/Kconfig | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

Index: linux-2.6-lttng.mm/init/Kconfig
===================================================================
--- linux-2.6-lttng.mm.orig/init/Kconfig 2008-01-24 14:18:34.000000000 -0500
+++ linux-2.6-lttng.mm/init/Kconfig 2008-01-24 14:29:28.000000000 -0500
@@ -472,6 +472,20 @@ config CC_OPTIMIZE_FOR_SIZE
config SYSCTL
bool

+config IMMEDIATE
+ default y if !DISABLE_IMMEDIATE
+ depends on HAVE_IMMEDIATE
+ bool
+ help
+ Immediate values are used as read-mostly variables that are rarely
+ updated. They use code patching to modify the values inscribed in the
+ instruction stream. It provides a way to save precious cache lines
+ that would otherwise have to be used by these variables. They can be
+ disabled through the EMBEDDED menu.
+
+config HAVE_IMMEDIATE
+ def_bool n
+
menuconfig EMBEDDED
bool "Configure standard kernel features (for small systems)"
help
@@ -716,6 +730,16 @@ config MARKERS

source "arch/Kconfig"

+config DISABLE_IMMEDIATE
+ default y if EMBEDDED
+ bool "Disable immediate values" if EMBEDDED
+ depends on HAVE_IMMEDIATE
+ help
+ Disable code patching based immediate values for embedded systems. It
+ consumes slightly more memory and requires to modify the instruction
+ stream each time a variable is updated. Should really be disabled for
+ embedded systems with read-only text.
+
endmenu # General setup

config SLABINFO