From owner-freebsd-stable@FreeBSD.ORG Tue Dec 20 17:45:22 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2194106567A for ; Tue, 20 Dec 2011 17:45:22 +0000 (UTC) (envelope-from tijl@coosemans.org) Received: from mailrelay011.isp.belgacom.be (mailrelay011.isp.belgacom.be [195.238.6.178]) by mx1.freebsd.org (Postfix) with ESMTP id 54FD48FC14 for ; Tue, 20 Dec 2011 17:45:21 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAJbI8E5bsVo6/2dsb2JhbABDq3+BBoFyAQEEAVUBIwULCxguOR4Zh3oCtyaIcoMaBKcw Received: from 58.90-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.90.58]) by relay.skynet.be with ESMTP; 20 Dec 2011 18:45:19 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.5/8.14.5) with ESMTP id pBKHjHiY005162; Tue, 20 Dec 2011 18:45:18 +0100 (CET) (envelope-from tijl@coosemans.org) From: Tijl Coosemans To: freebsd-stable@freebsd.org Date: Tue, 20 Dec 2011 18:45:08 +0100 User-Agent: KMail/1.13.7 (FreeBSD/9.0-RC2; KDE/4.7.3; i386; ; ) References: <20111220080437.M63044@martymac.org> <20111220134716.M62917@martymac.org> <20111220142740.M29405@martymac.org> In-Reply-To: <20111220142740.M29405@martymac.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2305471.X94DzsFhl4"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201112201845.15578.tijl@coosemans.org> Cc: Andriy Gapon , Ganael LAPLANCHE Subject: Re: Using mmap(2) with a hint address X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2011 17:45:22 -0000 --nextPart2305471.X94DzsFhl4 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable On Tuesday 20 December 2011 15:31:48 Ganael LAPLANCHE wrote: > On Tue, 20 Dec 2011 15:02:01 +0100 (CET), Ganael LAPLANCHE wrote >> But there is still something I don't understand : on the Linux >> machine where I ran my test program, the current RLIMIT_DATA >> is set to 0xffffffff/0xffffffff and I can manage to mmap at >> address 0x20000000. If I set the same limit on FreeBSD, I >> won't get the mapping at 0x20000000. So, there *is* a >> difference of behaviour between the two systems, but I don't >> understand why. >=20 > Well, in fact, two things remain not very clear for me : >=20 > - Why are mmap()s performed *after* data segment ? > =3D> It seems they can go within, on GNU/Linux and NetBSD. I don't know about NetBSD but Linux maps from the stack downwards when there's no hint and FreeBSD maps from the program upwards. That means that on Linux brk and mmap grow toward each other and unless you allocate a lot of memory they don't compete with each other. On FreeBSD brk and mmap do compete for the same space and this was resolved by preserving room for brk and moving mmap allocations further up. The case with hint lazily follows from that. Linux doesn't have any restrictions and FreeBSD preserves room for brk and moves the allocation up. > - Why do we have such a default value for datasize (8.2, amd64) : >=20 > $ limits > Resource limits (current): > cputime infinity secs > filesize infinity kB > datasize 33554432 kB >=20 > this is HUGE ! malloc(3) used to be implemented on top of brk(2) so the size was increased on amd64 so you could malloc more memory. Nowadays malloc can use mmap(2) so a large datasize isn't really needed anymore. > -- That should be "-- " (with space at the end). > Ganael LAPLANCHE > http://www.martymac.org | http://contribs.martymac.org > FreeBSD: martymac , http://www.FreeBSD.org --nextPart2305471.X94DzsFhl4 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF4EABEIAAYFAk7wyasACgkQfoCS2CCgtitabQD6Ayfas4afLznwteFfMw7eF/6B k+wSWCPpk37Tv6RrGdYA/iHew12MaB4/D/Pxe6riPrmXWcITn26mWnm0viVtvPP7 =CGLF -----END PGP SIGNATURE----- --nextPart2305471.X94DzsFhl4--