From owner-freebsd-arch@FreeBSD.ORG Fri Feb 1 09:47:31 2013 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DFFE7F38; Fri, 1 Feb 2013 09:47:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id F22387DD; Fri, 1 Feb 2013 09:47:30 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id LAA17527; Fri, 01 Feb 2013 11:47:24 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1U1DDQ-0000pu-2K; Fri, 01 Feb 2013 11:47:24 +0200 Message-ID: <510B8F2B.5070609@FreeBSD.org> Date: Fri, 01 Feb 2013 11:47:23 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130121 Thunderbird/17.0.2 MIME-Version: 1.0 To: Alan Cox Subject: Re: kva size on amd64 References: <507E7E59.8060201@FreeBSD.org> <51098743.2050603@FreeBSD.org> <510A2C09.6030709@FreeBSD.org> <510AB848.3010806@rice.edu> In-Reply-To: <510AB848.3010806@rice.edu> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: alc@FreeBSD.org, Alan Cox , freebsd-arch@FreeBSD.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2013 09:47:31 -0000 on 31/01/2013 20:30 Alan Cox said the following: > Try developing a different allocation strategy for the kmem_map. > First-fit is clearly not working well for the ZFS ARC, because of > fragmentation. For example, instead of further enlarging the kmem_map, > try splitting it into multiple submaps of the same total size, > kmem_map1, kmem_map2, etc. Then, utilize these akin to the "old" and > "new" spaces of a copying garbage collector or storage segments in a > log-structured file system. However, actual copying from an "old" space > to a "new" space may not be necessary. By the time that the "new" space > from which you are currently allocating fills up or becomes sufficiently > fragmented that you can't satisfy an allocation, you've likely created > enough contiguous space in an "old" space. > > I'll hypothesize that just a couple kmem_map submaps that are .625 of > physical memory size would suffice. The bottom line is that the total > virtual address space should be less than 2x physical memory. > > In fact, maybe the system starts off with just a single kmem_map, and > you only create additional kmem_maps on demand. As someone who doesn't > use ZFS that would actually save me physical memory that is currently > being wasted on unnecessary preallocated page table pages for my > kmem_map. This begins to sound like option (1) that you propose above. > > This might also help to keep physical memory fragmentation in check. Alan, very interesting suggestions, thank you! Of course, this is quite a bit more work than just jacking up some limit :-) So, it could be a while before any code materializes. Actually, I have been obsessed quite for some time with an idea of confining ZFS to its own submap. But ZFS does its allocations through malloc(9) and uma(9) (depending on configuration). It seemed like a bit of work to provide support for per-zone or per-tag submaps in uma and malloc. What is your opinion of this approach? P.S. BTW, do I understand correctly that the reservation of kernel page tables happens through vm_map_insert -> pmap_growkernel ? -- Andriy Gapon