From owner-svn-src-stable@FreeBSD.ORG Tue Sep 4 19:14:58 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 324F5106567B; Tue, 4 Sep 2012 19:14:58 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A45D8FC12; Tue, 4 Sep 2012 19:14:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q84JEv4J005538; Tue, 4 Sep 2012 19:14:57 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q84JEvd4005534; Tue, 4 Sep 2012 19:14:57 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201209041914.q84JEvd4005534@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Tue, 4 Sep 2012 19:14:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240097 - in stable/9/sys: amd64/include boot/common i386/include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2012 19:14:58 -0000 Author: des Date: Tue Sep 4 19:14:57 2012 New Revision: 240097 URL: http://svn.freebsd.org/changeset/base/240097 Log: MFH (r239255, r239730): increase maxswzone on i386 and remove it on amd64. Modified: stable/9/sys/amd64/include/param.h stable/9/sys/boot/common/loader.8 stable/9/sys/i386/include/param.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) Modified: stable/9/sys/amd64/include/param.h ============================================================================== --- stable/9/sys/amd64/include/param.h Tue Sep 4 19:04:02 2012 (r240096) +++ stable/9/sys/amd64/include/param.h Tue Sep 4 19:14:57 2012 (r240097) @@ -123,14 +123,6 @@ #define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */ /* - * Ceiling on amount of swblock kva space, can be changed via - * the kern.maxswzone /boot/loader.conf variable. - */ -#ifndef VM_SWZONE_SIZE_MAX -#define VM_SWZONE_SIZE_MAX (32 * 1024 * 1024) -#endif - -/* * Mach derived conversion macros */ #define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) Modified: stable/9/sys/boot/common/loader.8 ============================================================================== --- stable/9/sys/boot/common/loader.8 Tue Sep 4 19:04:02 2012 (r240096) +++ stable/9/sys/boot/common/loader.8 Tue Sep 4 19:14:57 2012 (r240097) @@ -613,17 +613,26 @@ Not all architectures use such buffers; for details. .It Va kern.maxswzone Limits the amount of KVM to be used to hold swap -meta information, which directly governs the -maximum amount of swap the system can support. -This value is specified in bytes of KVA space -and defaults to 32MBytes on i386 and amd64. -Care should be taken -to not reduce this value such that the actual -amount of configured swap exceeds 1/2 the -kernel-supported swap. -The default of 32MB allows -the kernel to support a maximum of ~7GB of swap. -Only change +metadata, which directly governs the +maximum amount of swap the system can support, +at the rate of approximately 200 MB of swap space +per 1 MB of metadata. +This value is specified in bytes of KVA space. +If no value is provided, the system allocates +enough memory to handle an amount of swap +that corresponds to eight times the amount of +physical memory present in the system. +.Pp +Note that swap metadata can be fragmented, +which means that the system can run out of +space before it reaches the theoretical limit. +Therefore, care should be taken to not configure +more swap than approximately half of the +theoretical maximum. +.Pp +Running out of space for swap metadata can leave +the system in an unrecoverable state. +Therefore, you should only change this parameter if you need to greatly extend the KVM reservation for other resources such as the buffer cache or Modified: stable/9/sys/i386/include/param.h ============================================================================== --- stable/9/sys/i386/include/param.h Tue Sep 4 19:04:02 2012 (r240096) +++ stable/9/sys/i386/include/param.h Tue Sep 4 19:14:57 2012 (r240097) @@ -125,9 +125,15 @@ /* * Ceiling on amount of swblock kva space, can be changed via * the kern.maxswzone /boot/loader.conf variable. + * + * 276 is sizeof(struct swblock), but we do not always have a definition + * in scope for struct swblock, so we have to hardcode it. Each struct + * swblock holds metadata for 32 pages, so in theory, this is enough for + * 16 GB of swap. In practice, however, the usable amount is considerably + * lower due to fragmentation. */ #ifndef VM_SWZONE_SIZE_MAX -#define VM_SWZONE_SIZE_MAX (32 * 1024 * 1024) +#define VM_SWZONE_SIZE_MAX (276 * 128 * 1024) #endif /*