From owner-svn-src-all@FreeBSD.ORG Wed Mar 23 16:38:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE7C8106564A; Wed, 23 Mar 2011 16:38:29 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B2378FC08; Wed, 23 Mar 2011 16:38:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2NGcTbl000743; Wed, 23 Mar 2011 16:38:29 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2NGcTxU000738; Wed, 23 Mar 2011 16:38:29 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201103231638.p2NGcTxU000738@svn.freebsd.org> From: Alan Cox Date: Wed, 23 Mar 2011 16:38:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219920 - in head/sys: i386/include kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Mar 2011 16:38:29 -0000 Author: alc Date: Wed Mar 23 16:38:29 2011 New Revision: 219920 URL: http://svn.freebsd.org/changeset/base/219920 Log: Modestly increase the maximum allowed size of the kmem map on i386. Also, express this new maximum as a fraction of the kernel's address space size rather than a constant so that increasing KVA_PAGES will automatically increase this maximum. As a side-effect of this change, kern.maxvnodes will automatically increase by a proportional amount. While I'm here ensure that this change doesn't result in an unintended increase in maxpipekva on i386. Calculate maxpipekva based upon the size of the kernel address space and the amount of physical memory instead of the size of the kmem map. The memory backing pipes is not allocated from the kmem map. It is allocated from its own submap of the kernel map. In short, it has no real connection to the kmem map. (In fact, the commit messages for the maxpipekva auto-sizing talk about using the kernel map size, cf. r117325 and r117391, even though the implementation actually used the kmem map size.) Although the calculation is now done differently, the resulting value for maxpipekva should remain almost the same on i386. However, on amd64, the value will be reduced by 2/3. This is intentional. The recent change to VM_KMEM_SIZE_SCALE on amd64 for the benefit of ZFS also had the unnecessary side-effect of increasing maxpipekva. This change is effectively restoring maxpipekva on amd64 to its prior value. Eliminate init_param3() since it is no longer used. Modified: head/sys/i386/include/vmparam.h head/sys/kern/kern_malloc.c head/sys/kern/subr_param.c head/sys/sys/systm.h Modified: head/sys/i386/include/vmparam.h ============================================================================== --- head/sys/i386/include/vmparam.h Wed Mar 23 16:28:11 2011 (r219919) +++ head/sys/i386/include/vmparam.h Wed Mar 23 16:38:29 2011 (r219920) @@ -189,7 +189,8 @@ * Ceiling on amount of kmem_map kva space. */ #ifndef VM_KMEM_SIZE_MAX -#define VM_KMEM_SIZE_MAX (320 * 1024 * 1024) +#define VM_KMEM_SIZE_MAX ((VM_MAX_KERNEL_ADDRESS - \ + VM_MIN_KERNEL_ADDRESS) * 2 / 5) #endif /* initial pagein size of beginning of executable file */ Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Wed Mar 23 16:28:11 2011 (r219919) +++ head/sys/kern/kern_malloc.c Wed Mar 23 16:38:29 2011 (r219920) @@ -709,11 +709,6 @@ kmeminit(void *dummy) if (((vm_kmem_size / 2) / PAGE_SIZE) > cnt.v_page_count) vm_kmem_size = 2 * cnt.v_page_count * PAGE_SIZE; - /* - * Tune settings based on the kmem map's size at this time. - */ - init_param3(vm_kmem_size / PAGE_SIZE); - #ifdef DEBUG_MEMGUARD tmp = memguard_fudge(vm_kmem_size, vm_kmem_size_max); #else Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Wed Mar 23 16:28:11 2011 (r219919) +++ head/sys/kern/subr_param.c Wed Mar 23 16:38:29 2011 (r219920) @@ -48,7 +48,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include /* * System parameter formulae. @@ -293,22 +295,17 @@ init_param2(long physpages) ncallout = 16 + maxproc + maxfiles; TUNABLE_INT_FETCH("kern.ncallout", &ncallout); -} - -/* - * Boot time overrides that are scaled against the kmem map - */ -void -init_param3(long kmempages) -{ /* - * The default for maxpipekva is max(5% of the kmem map, 512KB). - * See sys_pipe.c for more details. + * The default for maxpipekva is min(1/64 of the kernel address space, + * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details. */ - maxpipekva = (kmempages / 20) * PAGE_SIZE; + maxpipekva = (physpages / 64) * PAGE_SIZE; if (maxpipekva < 512 * 1024) maxpipekva = 512 * 1024; + if (maxpipekva > (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64) + maxpipekva = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / + 64; TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); } Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Wed Mar 23 16:28:11 2011 (r219919) +++ head/sys/sys/systm.h Wed Mar 23 16:38:29 2011 (r219920) @@ -171,7 +171,6 @@ void critical_enter(void); void critical_exit(void); void init_param1(void); void init_param2(long physpages); -void init_param3(long kmempages); void init_static_kenv(char *, size_t); void tablefull(const char *); int kvprintf(char const *, void (*)(int, void*), void *, int,