mmap performance and memory use
kostikbel at gmail.com
Thu Oct 6 16:29:46 UTC 2011
On Thu, Oct 06, 2011 at 04:41:45PM +0200, Wojciech Puchar wrote:
> i have few questions.
> 1) suppose i map 1TB of address space as anonymous and touch just one
> page. how much memory is used to manage this?
I am not sure how deep the enumeration you want to know, but the first
approximation will be:
one struct vm_map_entry
one struct vm_object
Page table structures need four pages for directories and page table proper.
> 2) suppose we have 1TB file on disk without holes and 100000 processes
> mmaps this file to it's address space. are just pages shared or can
> pagetables be shared too? how much memory is used to manage such
Only pages are shared. Pagetables are not.
For one thing, this indeed causes more memory use for the OS. This is
somewhat mitigated by automatic use of superpages. Superpage promotion
still keeps the 4KB page table around, so most savings from the
superpages are due to more efficient use of TLB.
On the other hand, having non-shared page tables allows for much more
accurate tracking of the accesses and writes, which can result in better
For the situation 1TB/100000 processes, you will probably need to tune
the amount of pv entries, see sysctl vm.pmap.pv*.
> yes this is a real question - assume most of these processes are mostly
> sleeping but every now and then do something and work of some set of
> pages from this file and there is enough memory in computer to keep this
> working set, but only if managing it by OS will not overuse memory.
> freebsd-hackers at freebsd.org mailing list
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20111006/ea08f629/attachment.pgp
More information about the freebsd-hackers