From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 6 16:29:46 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74710106566C for ; Thu, 6 Oct 2011 16:29:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id E70398FC12 for ; Thu, 6 Oct 2011 16:29:45 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p96G206A024008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 6 Oct 2011 19:02:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id p96G1x0p098608; Thu, 6 Oct 2011 19:01:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id p96G1xel098607; Thu, 6 Oct 2011 19:01:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 6 Oct 2011 19:01:59 +0300 From: Kostik Belousov To: Wojciech Puchar Message-ID: <20111006160159.GQ1511@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1jIccons5TjyLah6" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: hackers@freebsd.org, Grzegorz Kulewski Subject: Re: mmap performance and memory use X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2011 16:29:46 -0000 --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--