Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Oct 2011 19:01:59 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl>
Cc:        hackers@freebsd.org, Grzegorz Kulewski <grzegorz@kulewski.pl>
Subject:   Re: mmap performance and memory use
Message-ID:  <20111006160159.GQ1511@deviant.kiev.zoral.com.ua>
In-Reply-To: <alpine.BSF.2.00.1110061637270.15552@wojtek.tensor.gdynia.pl>
References:  <alpine.BSF.2.00.1110061637270.15552@wojtek.tensor.gdynia.pl>

next in thread | previous in thread | raw e-mail | index | archive | help

--1jIccons5TjyLah6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Oct 06, 2011 at 04:41:45PM +0200, Wojciech Puchar wrote:
> i have few questions.
>=20
> 1) suppose i map 1TB of address space as anonymous and touch just one=20
> 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.
>=20
> 2) suppose we have 1TB file on disk without holes and 100000 processes=20
> mmaps this file to it's address space. are just pages shared or can=20
> pagetables be shared too? how much memory is used to manage such=20
> 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.

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
pageout performance.

For the situation 1TB/100000 processes, you will probably need to tune
the amount of pv entries, see sysctl vm.pmap.pv*.
>=20
> yes this is a real question - assume most of these processes are mostly=
=20
> sleeping but every now and then do something and work of some set of=20
> pages from this file and there is enough memory in computer to keep this=
=20
> working set, but only if managing it by OS will not overuse memory.
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"

--1jIccons5TjyLah6
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iEYEARECAAYFAk6N0PcACgkQC3+MBN1Mb4im0wCfbSpLN473jBiTzy/mOQflRhvO
i3cAoNVkxpInQLGVouyO7LjIC1i7KAYG
=qYXK
-----END PGP SIGNATURE-----

--1jIccons5TjyLah6--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111006160159.GQ1511>