From owner-freebsd-amd64@FreeBSD.ORG Mon May 9 19:06:21 2011 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0268106566C; Mon, 9 May 2011 19:06:21 +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 32DAB8FC16; Mon, 9 May 2011 19:06:20 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p49J6EiU083388 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 9 May 2011 22:06:14 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p49J6ECo076888; Mon, 9 May 2011 22:06:14 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p49J6EZq076887; Mon, 9 May 2011 22:06:14 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 9 May 2011 22:06:14 +0300 From: Kostik Belousov To: Brad Waite Message-ID: <20110509190614.GJ48734@deviant.kiev.zoral.com.ua> References: <4DC816F4.1030406@wcubed.net> <201105091327.36809.jhb@freebsd.org> <4DC831AE.1070103@wcubed.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Z/W+H++SBmO57jII" Content-Disposition: inline In-Reply-To: <4DC831AE.1070103@wcubed.net> 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.4 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: freebsd-amd64@freebsd.org Subject: Re: Understanding i386 PAE X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 19:06:21 -0000 --Z/W+H++SBmO57jII Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 09, 2011 at 12:25:50PM -0600, Brad Waite wrote: > On 5/9/2011 11:27 AM, John Baldwin wrote: >=20 > Thanks for the clarification, John. >=20 > > FreeBSD uses a shared address space on x86 (both i386 and amd64) where > > the kernel is mapped into every process' address space at a fixed addre= ss. =20 > > This makes it cheaper and easier to copy data between a user process an= d the=20 > > kernel since you don't have to temporarily map user pages into the kern= el's=20 > > address space, etc. >=20 > That's disappointing for my use, but it make sense. >=20 > > It is possible to use separate address spaces for the kernel and userla= nd=20 > > (other OS's have done this) so that you could have 4G for the kernel an= d 4G=20 > > for userland. However, this would require a good bit of work in the ke= rnel=20 > > (e.g. copyin/copyout would have to start mapping user pages at temporar= y=20 > > addresses in the kernel). >=20 > Would be handy to be able to use memory this way, but if I were > responsible for making it happen, I'm sure that we'd be on amd128 before > it was finished. ;) Jeff had patches that implemented this. Redhat did patched their kernel for some time, but finally decided not to do anymore. It is much more trouble then the gain on x86. >=20 > > As you have noted, PAE does not increase your virtual address space, me= rely=20 > > your physical address space by changing PTEs to use 64-bit physical add= resses=20 > > instead of 32-bit physical addresses. However, each process can only a= ddress=20 > > up to 4G of RAM at a time. >=20 > So given the shared address space, the amount of memory the kernel can > use doesn't benefit much from PAE. I can see how typical installs with > lots/big userland processes and the standard 1G KVA would benefit, > though. Since I'm trying to eke as much memory as I can for ZFS, I don't > gain much. >=20 > I suppose I could allocate 3.75G for the kernel, assuming that none of > my userland processes need more than .25G (or that if they do, swapping > to disk is okay). I am sure it will not even start init(8). Note that 250Mb is the _virtual address space_, and not the physical memory available to=20 the process. Well, init(8) is static, so it might start, but I am sure that e.g. sh(1) will not. Also, even if you allocate ~3GB for kernel KVA, the amount of space available for ZFS cache will be less then this, probably much less. Due to other kernel users for VA, and due to fragmentation. >=20 > Would that be pushing it? I've come across a few things about hardware > addresses eating up 256M - 512M of RAM - is that still the case with > PAE? If that is pushing it, what's the max KVA you'd recommend. First, you should indeed understand the difference between physical memory pages (which PAE allows to have large pool of) and virtual address space. After that, you would see clearly that what you are trying to do is mostly a waste. Esp. due to ZFS architecture of having directly addressed pages in the cache. UFS with page cache/buffers would use as much pages as provided for caching. --Z/W+H++SBmO57jII Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk3IOyYACgkQC3+MBN1Mb4gVTgCfb5TUcubh2SuyVbzVVvu3pzwx qrkAn1s/Ltq9jqE04C/deV7vrWC0QvM1 =9Nq0 -----END PGP SIGNATURE----- --Z/W+H++SBmO57jII--