aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorJie Zhang <jie.zhang@analog.com>2009-12-14 21:00:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-15 11:53:24 -0500
commitea637639591def87a54cea811cbac796980cb30d (patch)
tree7ea3e4baf2ffade539ae30192521d331f8e863fa /init
parent5dc37642cbce34619e4588a9f0bdad1d2f870956 (diff)
nommu: fix malloc performance by adding uninitialized flag
The NOMMU code currently clears all anonymous mmapped memory. While this is what we want in the default case, all memory allocation from userspace under NOMMU has to go through this interface, including malloc() which is allowed to return uninitialized memory. This can easily be a significant performance penalty. So for constrained embedded systems were security is irrelevant, allow people to avoid clearing memory unnecessarily. This also alters the ELF-FDPIC binfmt such that it obtains uninitialised memory for the brk and stack region. Signed-off-by: Jie Zhang <jie.zhang@analog.com> Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Paul Mundt <lethal@linux-sh.org> Acked-by: Greg Ungerer <gerg@snapgear.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig22
1 files changed, 22 insertions, 0 deletions
diff --git a/init/Kconfig b/init/Kconfig
index 54c655ce9c04..a23da9f01803 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1079,6 +1079,28 @@ config SLOB
1079 1079
1080endchoice 1080endchoice
1081 1081
1082config MMAP_ALLOW_UNINITIALIZED
1083 bool "Allow mmapped anonymous memory to be uninitialized"
1084 depends on EMBEDDED && !MMU
1085 default n
1086 help
1087 Normally, and according to the Linux spec, anonymous memory obtained
1088 from mmap() has it's contents cleared before it is passed to
1089 userspace. Enabling this config option allows you to request that
1090 mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
1091 providing a huge performance boost. If this option is not enabled,
1092 then the flag will be ignored.
1093
1094 This is taken advantage of by uClibc's malloc(), and also by
1095 ELF-FDPIC binfmt's brk and stack allocator.
1096
1097 Because of the obvious security issues, this option should only be
1098 enabled on embedded devices where you control what is run in
1099 userspace. Since that isn't generally a problem on no-MMU systems,
1100 it is normally safe to say Y here.
1101
1102 See Documentation/nommu-mmap.txt for more information.
1103
1082config PROFILING 1104config PROFILING
1083 bool "Profiling support (EXPERIMENTAL)" 1105 bool "Profiling support (EXPERIMENTAL)"
1084 help 1106 help