[patch 03/12] Immediate Values - Kconfig menu in EMBEDDED

Mathieu Desnoyers
2009-09-24T14:43:15Z

[-- Attachment #1: immediate-values-kconfig-menu-in-embedded.patch --]
[-- Type: text/plain, Size: 2319 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 HAS_IMMEDIATE
- Turn DISABLE_IMMEDIATE into positive logic

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: Christoph Hellwig <hch@infradead.org>
CC: mingo@elte.hu
CC: akpm@osdl.org
---
init/Kconfig | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

Index: linux.trees.git/init/Kconfig
===================================================================
--- linux.trees.git.orig/init/Kconfig 2009-09-24 08:52:55.000000000 -0400
+++ linux.trees.git/init/Kconfig 2009-09-24 09:00:20.000000000 -0400
@@ -1088,6 +1088,24 @@ config SLOW_WORK

See Documentation/slow-work.txt.

+config HAVE_IMMEDIATE
+ def_bool n
+
+config IMMEDIATE
+ default y
+ depends on HAVE_IMMEDIATE
+ bool "Immediate value optimization" if EMBEDDED
+ 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.
+
+ It consumes slightly more memory and modifies the instruction stream
+ each time any specially-marked variable is updated. Should really be
+ disabled for embedded systems with read-only text.
+
endmenu # General setup

config HAVE_GENERIC_DMA_COHERENT