mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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 <[email protected]> Signed-off-by: David Howells <[email protected]> Tested-by: Mike Frysinger <[email protected]>
This commit is contained in:
parent
8feae13110
commit
dd8632a12e
5 changed files with 90 additions and 23 deletions
|
|
@ -248,3 +248,18 @@ PROVIDING SHAREABLE BLOCK DEVICE SUPPORT
|
|||
Provision of shared mappings on block device files is exactly the same as for
|
||||
character devices. If there isn't a real device underneath, then the driver
|
||||
should allocate sufficient contiguous memory to honour any supported mapping.
|
||||
|
||||
|
||||
=================================
|
||||
ADJUSTING PAGE TRIMMING BEHAVIOUR
|
||||
=================================
|
||||
|
||||
NOMMU mmap automatically rounds up to the nearest power-of-2 number of pages
|
||||
when performing an allocation. This can have adverse effects on memory
|
||||
fragmentation, and as such, is left configurable. The default behaviour is to
|
||||
aggressively trim allocations and discard any excess pages back in to the page
|
||||
allocator. In order to retain finer-grained control over fragmentation, this
|
||||
behaviour can either be disabled completely, or bumped up to a higher page
|
||||
watermark where trimming begins.
|
||||
|
||||
Page trimming behaviour is configurable via the sysctl `vm.nr_trim_pages'.
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ Currently, these files are in /proc/sys/vm:
|
|||
- numa_zonelist_order
|
||||
- nr_hugepages
|
||||
- nr_overcommit_hugepages
|
||||
- nr_trim_pages (only if CONFIG_MMU=n)
|
||||
|
||||
==============================================================
|
||||
|
||||
|
|
@ -348,3 +349,20 @@ Change the maximum size of the hugepage pool. The maximum is
|
|||
nr_hugepages + nr_overcommit_hugepages.
|
||||
|
||||
See Documentation/vm/hugetlbpage.txt
|
||||
|
||||
==============================================================
|
||||
|
||||
nr_trim_pages
|
||||
|
||||
This is available only on NOMMU kernels.
|
||||
|
||||
This value adjusts the excess page trimming behaviour of power-of-2 aligned
|
||||
NOMMU mmap allocations.
|
||||
|
||||
A value of 0 disables trimming of allocations entirely, while a value of 1
|
||||
trims excess pages aggressively. Any value >= 1 acts as the watermark where
|
||||
trimming of allocations is initiated.
|
||||
|
||||
The default value is 1.
|
||||
|
||||
See Documentation/nommu-mmap.txt for more information.
|
||||
|
|
|
|||
Loading…
Reference in a new issue