diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-01-08 07:04:47 -0500 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2009-01-08 07:04:47 -0500 |
commit | dd8632a12e500a684478fea0951f380478d56fed (patch) | |
tree | 1a12f441f9de14fd233faa92cf13a5fbb0319f41 /Documentation | |
parent | 8feae13110d60cc6287afabc2887366b0eb226c2 (diff) |
NOMMU: Make mmap allocation page trimming behaviour configurable.
NOMMU mmap allocates a piece of memory for an mmap that's rounded up in size to
the nearest power-of-2 number of pages. Currently it then discards the excess
pages back to the page allocator, making that memory available for use by other
things. This can, however, cause greater amount of fragmentation.
To counter this, a sysctl is added in order to fine-tune the trimming
behaviour. The default behaviour remains to trim pages aggressively, while
this can either be disabled completely or set to a higher page-granular
watermark in order to have finer-grained control.
vm region vm_top bits taken from an earlier patch by David Howells.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Mike Frysinger <vapier.adi@gmail.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/nommu-mmap.txt | 15 | ||||
-rw-r--r-- | Documentation/sysctl/vm.txt | 18 |
2 files changed, 33 insertions, 0 deletions
diff --git a/Documentation/nommu-mmap.txt b/Documentation/nommu-mmap.txt index 02b89dcf38a..b565e8279d1 100644 --- a/Documentation/nommu-mmap.txt +++ b/Documentation/nommu-mmap.txt | |||
@@ -248,3 +248,18 @@ PROVIDING SHAREABLE BLOCK DEVICE SUPPORT | |||
248 | Provision of shared mappings on block device files is exactly the same as for | 248 | Provision of shared mappings on block device files is exactly the same as for |
249 | character devices. If there isn't a real device underneath, then the driver | 249 | character devices. If there isn't a real device underneath, then the driver |
250 | should allocate sufficient contiguous memory to honour any supported mapping. | 250 | should allocate sufficient contiguous memory to honour any supported mapping. |
251 | |||
252 | |||
253 | ================================= | ||
254 | ADJUSTING PAGE TRIMMING BEHAVIOUR | ||
255 | ================================= | ||
256 | |||
257 | NOMMU mmap automatically rounds up to the nearest power-of-2 number of pages | ||
258 | when performing an allocation. This can have adverse effects on memory | ||
259 | fragmentation, and as such, is left configurable. The default behaviour is to | ||
260 | aggressively trim allocations and discard any excess pages back in to the page | ||
261 | allocator. In order to retain finer-grained control over fragmentation, this | ||
262 | behaviour can either be disabled completely, or bumped up to a higher page | ||
263 | watermark where trimming begins. | ||
264 | |||
265 | Page trimming behaviour is configurable via the sysctl `vm.nr_trim_pages'. | ||
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt index cd05994a49e..a3415070bca 100644 --- a/Documentation/sysctl/vm.txt +++ b/Documentation/sysctl/vm.txt | |||
@@ -38,6 +38,7 @@ Currently, these files are in /proc/sys/vm: | |||
38 | - numa_zonelist_order | 38 | - numa_zonelist_order |
39 | - nr_hugepages | 39 | - nr_hugepages |
40 | - nr_overcommit_hugepages | 40 | - nr_overcommit_hugepages |
41 | - nr_trim_pages (only if CONFIG_MMU=n) | ||
41 | 42 | ||
42 | ============================================================== | 43 | ============================================================== |
43 | 44 | ||
@@ -348,3 +349,20 @@ Change the maximum size of the hugepage pool. The maximum is | |||
348 | nr_hugepages + nr_overcommit_hugepages. | 349 | nr_hugepages + nr_overcommit_hugepages. |
349 | 350 | ||
350 | See Documentation/vm/hugetlbpage.txt | 351 | See Documentation/vm/hugetlbpage.txt |
352 | |||
353 | ============================================================== | ||
354 | |||
355 | nr_trim_pages | ||
356 | |||
357 | This is available only on NOMMU kernels. | ||
358 | |||
359 | This value adjusts the excess page trimming behaviour of power-of-2 aligned | ||
360 | NOMMU mmap allocations. | ||
361 | |||
362 | A value of 0 disables trimming of allocations entirely, while a value of 1 | ||
363 | trims excess pages aggressively. Any value >= 1 acts as the watermark where | ||
364 | trimming of allocations is initiated. | ||
365 | |||
366 | The default value is 1. | ||
367 | |||
368 | See Documentation/nommu-mmap.txt for more information. | ||