|author||Jie Zhang <firstname.lastname@example.org>||2009-12-14 18:00:02 -0800|
|committer||Linus Torvalds <email@example.com>||2009-12-15 08:53:24 -0800|
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 <firstname.lastname@example.org> Signed-off-by: Robin Getz <email@example.com> Signed-off-by: Mike Frysinger <firstname.lastname@example.org> Signed-off-by: David Howells <email@example.com> Acked-by: Paul Mundt <firstname.lastname@example.org> Acked-by: Greg Ungerer <email@example.com> Signed-off-by: Andrew Morton <firstname.lastname@example.org> Signed-off-by: Linus Torvalds <email@example.com>
Diffstat (limited to 'init/Kconfig')
1 files changed, 22 insertions, 0 deletions
diff --git a/init/Kconfig b/init/Kconfig
index 54c655ce9c0..a23da9f0180 100644
@@ -1079,6 +1079,28 @@ config SLOB
+ bool "Allow mmapped anonymous memory to be uninitialized"
+ depends on EMBEDDED && !MMU
+ default n
+ Normally, and according to the Linux spec, anonymous memory obtained
+ from mmap() has it's contents cleared before it is passed to
+ userspace. Enabling this config option allows you to request that
+ mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
+ providing a huge performance boost. If this option is not enabled,
+ then the flag will be ignored.
+ This is taken advantage of by uClibc's malloc(), and also by
+ ELF-FDPIC binfmt's brk and stack allocator.
+ Because of the obvious security issues, this option should only be
+ enabled on embedded devices where you control what is run in
+ userspace. Since that isn't generally a problem on no-MMU systems,
+ it is normally safe to say Y here.
+ See Documentation/nommu-mmap.txt for more information.
bool "Profiling support (EXPERIMENTAL)"