diff options
author | David Howells <dhowells@redhat.com> | 2009-05-06 19:03:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-06 19:36:10 -0400 |
commit | fc4d5c292b68ef02514d2072dcbf82d090c34875 (patch) | |
tree | 6baf6c7a472e57e99e1b6555c277060f7065f482 /mm/Kconfig | |
parent | 3a6be87fd1e5cdbbc3b6a14d02a3efa9ecba1d3f (diff) |
nommu: make the initial mmap allocation excess behaviour Kconfig configurable
NOMMU mmap() has an option controlled by a sysctl variable that determines
whether the allocations made by do_mmap_private() should have the excess
space trimmed off and returned to the allocator. Make the initial setting
of this variable a Kconfig configuration option.
The reason there can be excess space is that the allocator only allocates
in power-of-2 size chunks, but mmap()'s can be made in sizes that aren't a
power of 2.
There are two alternatives:
(1) Keep the excess as dead space. The dead space then remains unused for the
lifetime of the mapping. Mappings of shared objects such as libc, ld.so
or busybox's text segment may retain their dead space forever.
(2) Return the excess to the allocator. This means that the dead space is
limited to less than a page per mapping, but it means that for a transient
process, there's more chance of fragmentation as the excess space may be
reused fairly quickly.
During the boot process, a lot of transient processes are created, and
this can cause a lot of fragmentation as the pagecache and various slabs
grow greatly during this time.
By turning off the trimming of excess space during boot and disabling
batching of frees, Coldfire can manage to boot.
A better way of doing things might be to have /sbin/init turn this option
off. By that point libc, ld.so and init - which are all long-duration
processes - have all been loaded and trimmed.
Reported-by: Lanttor Guo <lanttor.guo@freescale.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Lanttor Guo <lanttor.guo@freescale.com>
Cc: 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 'mm/Kconfig')
-rw-r--r-- | mm/Kconfig | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/mm/Kconfig b/mm/Kconfig index 57971d2ab848..c2b57d81e153 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
@@ -225,3 +225,31 @@ config HAVE_MLOCKED_PAGE_BIT | |||
225 | 225 | ||
226 | config MMU_NOTIFIER | 226 | config MMU_NOTIFIER |
227 | bool | 227 | bool |
228 | |||
229 | config NOMMU_INITIAL_TRIM_EXCESS | ||
230 | int "Turn on mmap() excess space trimming before booting" | ||
231 | depends on !MMU | ||
232 | default 1 | ||
233 | help | ||
234 | The NOMMU mmap() frequently needs to allocate large contiguous chunks | ||
235 | of memory on which to store mappings, but it can only ask the system | ||
236 | allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently | ||
237 | more than it requires. To deal with this, mmap() is able to trim off | ||
238 | the excess and return it to the allocator. | ||
239 | |||
240 | If trimming is enabled, the excess is trimmed off and returned to the | ||
241 | system allocator, which can cause extra fragmentation, particularly | ||
242 | if there are a lot of transient processes. | ||
243 | |||
244 | If trimming is disabled, the excess is kept, but not used, which for | ||
245 | long-term mappings means that the space is wasted. | ||
246 | |||
247 | Trimming can be dynamically controlled through a sysctl option | ||
248 | (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of | ||
249 | excess pages there must be before trimming should occur, or zero if | ||
250 | no trimming is to occur. | ||
251 | |||
252 | This option specifies the initial value of this option. The default | ||
253 | of 1 says that all excess pages should be trimmed. | ||
254 | |||
255 | See Documentation/nommu-mmap.txt for more information. | ||