From owner-svn-src-head@FreeBSD.ORG Sat Nov 10 02:08:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BF160202; Sat, 10 Nov 2012 02:08:40 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9B2168FC0A; Sat, 10 Nov 2012 02:08:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAA28epF004845; Sat, 10 Nov 2012 02:08:40 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAA28e0v004842; Sat, 10 Nov 2012 02:08:40 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <201211100208.qAA28e0v004842@svn.freebsd.org> From: Alfred Perlstein Date: Sat, 10 Nov 2012 02:08:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r242847 - in head/sys: i386/include kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Nov 2012 02:08:40 -0000 Author: alfred Date: Sat Nov 10 02:08:40 2012 New Revision: 242847 URL: http://svnweb.freebsd.org/changeset/base/242847 Log: Allow maxusers to scale on machines with large address space. Some hooks are added to clamp down maxusers and nmbclusters for small address space systems. VM_MAX_AUTOTUNE_MAXUSERS - the max maxusers that will be autotuned based on physical memory. VM_MAX_AUTOTUNE_NMBCLUSTERS - max nmbclusters based on physical memory. These are set to the old values on i386 to preserve the clamping that was being done to all arches. Another macro VM_AUTOTUNE_NMBCLUSTERS is provided to allow an override for the calculation on a MD basis. Currently no arch defines this. Reviewed by: peter MFC after: 2 weeks Modified: head/sys/i386/include/vmparam.h head/sys/kern/kern_mbuf.c head/sys/kern/subr_param.c Modified: head/sys/i386/include/vmparam.h ============================================================================== --- head/sys/i386/include/vmparam.h Sat Nov 10 02:08:19 2012 (r242846) +++ head/sys/i386/include/vmparam.h Sat Nov 10 02:08:40 2012 (r242847) @@ -202,4 +202,13 @@ #define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ +#ifndef VM_MAX_AUTOTUNE_MAXUSERS +#define VM_MAX_AUTOTUNE_MAXUSERS 384 +#endif + +#ifndef VM_MAX_AUTOTUNE_NMBCLUSTERS +/* old maxusers max value. */ +#define VM_MAX_AUTOTUNE_NMBCLUSTERS (1024 + VM_MAX_AUTOTUNE_MAXUSERS * 64) +#endif + #endif /* _MACHINE_VMPARAM_H_ */ Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Sat Nov 10 02:08:19 2012 (r242846) +++ head/sys/kern/kern_mbuf.c Sat Nov 10 02:08:40 2012 (r242847) @@ -113,8 +113,17 @@ tunable_mbinit(void *dummy) /* This has to be done before VM init. */ TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters); - if (nmbclusters == 0) + if (nmbclusters == 0) { +#ifdef VM_AUTOTUNE_NMBCLUSTERS + nmbclusters = VM_AUTOTUNE_NMBCLUSTERS; +#else nmbclusters = 1024 + maxusers * 64; +#endif +#ifdef VM_MAX_AUTOTUNE_NMBCLUSTERS + if (nmbclusters > VM_MAX_AUTOTUNE_NMBCLUSTERS) + nmbclusters = VM_MAX_AUTOTUNE_NMBCLUSTERS; +#endif + } TUNABLE_INT_FETCH("kern.ipc.nmbjumbop", &nmbjumbop); if (nmbjumbop == 0) Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Sat Nov 10 02:08:19 2012 (r242846) +++ head/sys/kern/subr_param.c Sat Nov 10 02:08:40 2012 (r242847) @@ -278,17 +278,17 @@ init_param2(long physpages) maxusers = physpages / (2 * 1024 * 1024 / PAGE_SIZE); if (maxusers < 32) maxusers = 32; - /* - * Clips maxusers to 384 on machines with <= 4GB RAM or 32bit. - * Scales it down 6x for large memory machines. - */ - if (maxusers > 384) { - if (sizeof(void *) <= 4) - maxusers = 384; - else - maxusers = 384 + ((maxusers - 384) / 6); - } - } +#ifdef VM_MAX_AUTOTUNE_MAXUSERS + if (maxusers > VM_MAX_AUTOTUNE_MAXUSERS) + maxusers = VM_MAX_AUTOTUNE_MAXUSERS; +#endif + /* + * Scales down the function in which maxusers grows once + * we hit 384. + */ + if (maxusers > 384) + maxusers = 384 + ((maxusers - 384) / 8); + } /* * The following can be overridden after boot via sysctl. Note: