On Thu, Oct 6, 2011 at 11:01 AM, Kostik Belousov <kostik...@gmail.com>wrote:

> 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
> one pv_entry
>
> 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
> > situation?
> 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.
>
>
You are correct about the page table page.  However, a superpage mapping
consumes a single PV entry, in place of 512 or 1024 PV entries.  This winds
up saving about three physical pages worth of memory for every superpage
mapping.

Alan
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to