mmap performance and memory use
alc at rice.edu
Tue Oct 11 16:12:46 UTC 2011
On 10/10/2011 16:28, Wojciech Puchar wrote:
>> Notice that vm.pmap.pde.promotions increased by 31. This means that
>> 31 superpage mappings were created by promotion from small page
> thank you. i looked at .mappings as it seemed logical for me that is
> shows total.
>> In contrast, vm.pmap.pde.mappings counts superpage mappings that are
>> created directly and not by promotion from small page mappings. For
>> example, if a large executable, such as gcc, is resident in memory,
>> the text segment will be pre-mapped using superpage mappings,
>> avoiding soft fault and promotion overhead. Similarly, mmap(...,
>> MAP_PREFAULT_READ) on a large, memory resident file may pre-map the
>> file using superpage mappings.
> your options are not described in mmap manpage nor madvise
> when can i find the up to date manpage or description?
It is documented in mmap(2) on HEAD and 9.x:
Immediately update the calling process's
virtual address translation structures, such as its
page table, so that every memory resident page
the region is mapped for read access.
structures are updated lazily. The effect of this
option is to eliminate any soft faults that
erwise occur on the initial read accesses to the
region. Although this option does not preclude prot
from including PROT_WRITE, it does not eliminate
faults on the initial write accesses to the region.
I don't believe that this feature was merged into to 8.x. However,
there is no technical reason that it can't be merged.
> is it possible to force VM subsystem to operate on superpages when
> possible - i mean swapping in 2MB chunks?
Currently, no. For some applications, like the Sun/Oracle JVM, that
have code to explicitly manage large pages, there could be some benefit
in the form of reduced overhead. So, it's on my "to do" list, but no
where near the top of that list.
More information about the freebsd-hackers