From owner-freebsd-arch@FreeBSD.ORG Thu Jan 31 08:10:14 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F015DB80; Thu, 31 Jan 2013 08:10:14 +0000 (UTC) (envelope-from alan.l.cox@gmail.com) Received: from mail-oa0-f45.google.com (mail-oa0-f45.google.com [209.85.219.45]) by mx1.freebsd.org (Postfix) with ESMTP id B55171B0; Thu, 31 Jan 2013 08:10:14 +0000 (UTC) Received: by mail-oa0-f45.google.com with SMTP id o6so2732609oag.32 for ; Thu, 31 Jan 2013 00:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:reply-to:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=PkgrAgwYtKMZX2tpGLcZrm0DMa25FIyIPtJ6Z2fsq6E=; b=OXmByQt+wka/OdY5S6h8ueAgxjcYr0skHCzsvpl1fcw1Dhf00dV42i2i+AgAlm3D9L KqUzWZsTZ3qevmGKs8+D8ue/11++t/CLNlqzYJ5S9YbqtZzKUbU3kLk0Hxr9xnKlgkeW DzJipOAcCH5S8R7HZlWtNqh25M+DPpxnXzIzR75YvFUlW1PjwO4U7eCwFqIhMNLD7Ecd UFt+zzIELPdLNVy9vSd/TscjpmGdKmQU/TsiEBRlAXRVVjZHBEPf15gP6c4OeluT3G6V +6jzGLfw8Yg0ySSRajIVen/mUSfAg6Vvg2qjDNVp8fzaJUirSilal09zCgJ2lsU9q0+G PWPg== MIME-Version: 1.0 X-Received: by 10.182.43.103 with SMTP id v7mr5775361obl.17.1359619813954; Thu, 31 Jan 2013 00:10:13 -0800 (PST) Received: by 10.182.102.69 with HTTP; Thu, 31 Jan 2013 00:10:13 -0800 (PST) In-Reply-To: <51098743.2050603@FreeBSD.org> References: <507E7E59.8060201@FreeBSD.org> <51098743.2050603@FreeBSD.org> Date: Thu, 31 Jan 2013 02:10:13 -0600 Message-ID: Subject: Re: kva size on amd64 From: Alan Cox To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: alc@freebsd.org List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2013 08:10:15 -0000 On Wed, Jan 30, 2013 at 2:49 PM, Andriy Gapon wrote: > on 17/10/2012 12:46 Andriy Gapon said the following: > > > > What are the main benefits, if any, of limiting KVA space size - or in > fact > > tying it to physical memory size - on amd64? > > This question is perhaps relevant to other platforms with "unlimited > kva" too. > > I actually already have patch that auto-sets kmem_size to kmem_size_max on > amd64. > > My primary motivation is that I from time to time still see reports about > too > small kmem_map on non-tuned amd64 systems. This is really ridiculous > regardless of whether there is ZFS in use or not. > > Another motivation is that I really see no reason at all to artificially > limit > KVA. This creates no benefits, increases fragility and reduces > flexibility. > > > In short, it will waste a non-trivial amount of physical memory. Unlike user virtual address spaces, page table pages are preallocated for the kernel virtual address space. More precisely, they are preallocated for the reserved (or defined) regions of the kernel map, i.e., every range of addresses that has a corresponding vm_map_entry. The kmem map is one such reserved region. So, if you always set your kmem map to its maximum possible size of ~300GB, then you are preallocating about 600MB of physical memory for page table pages that will never be used (except on machines with 300+ GB of DRAM).