From owner-svn-src-all@FreeBSD.ORG Sun Jan 9 12:50:45 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 26F4D10656A9; Sun, 9 Jan 2011 12:50:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 12EC18FC22; Sun, 9 Jan 2011 12:50:45 +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 p09CoifZ043266; Sun, 9 Jan 2011 12:50:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p09CoiTI043253; Sun, 9 Jan 2011 12:50:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201101091250.p09CoiTI043253@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 9 Jan 2011 12:50:44 +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: r217192 - in head: bin/ps sys/amd64/include sys/arm/include sys/i386/include sys/ia64/include sys/mips/include sys/powerpc/include sys/sparc64/include sys/sun4v/include sys/sys sys/vm 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: Sun, 09 Jan 2011 12:50:45 -0000 Author: kib Date: Sun Jan 9 12:50:44 2011 New Revision: 217192 URL: http://svn.freebsd.org/changeset/base/217192 Log: Move repeated MAXSLP definition from machine/vmparam.h to sys/vmmeter.h. Update the outdated comments describing MAXSLP and the process selection algorithm for swap out. Comments wording and reviewed by: alc Modified: head/bin/ps/print.c head/sys/amd64/include/vmparam.h head/sys/arm/include/vmparam.h head/sys/i386/include/vmparam.h head/sys/ia64/include/vmparam.h head/sys/mips/include/vmparam.h head/sys/powerpc/include/vmparam.h head/sys/sparc64/include/vmparam.h head/sys/sun4v/include/vmparam.h head/sys/sys/vmmeter.h head/sys/vm/vm_glue.c head/sys/vm/vm_meter.c Modified: head/bin/ps/print.c ============================================================================== --- head/bin/ps/print.c Sun Jan 9 12:38:40 2011 (r217191) +++ head/bin/ps/print.c Sun Jan 9 12:50:44 2011 (r217192) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: head/sys/amd64/include/vmparam.h ============================================================================== --- head/sys/amd64/include/vmparam.h Sun Jan 9 12:38:40 2011 (r217191) +++ head/sys/amd64/include/vmparam.h Sun Jan 9 12:50:44 2011 (r217192) @@ -70,17 +70,6 @@ #endif /* - * The time for a process to be blocked before being very swappable. - * This is a number of seconds which the system takes as being a non-trivial - * amount of real time. You probably shouldn't change this; - * it is used in subtle ways (fractions and multiples of it are, that is, like - * half of a ``long time'', almost a long time, etc.) - * It is related to human patience and other factors which don't really - * change over time. - */ -#define MAXSLP 20 - -/* * We provide a machine specific single page allocator through the use * of the direct mapped segment. This uses 2MB pages for reduced * TLB pressure. Modified: head/sys/arm/include/vmparam.h ============================================================================== --- head/sys/arm/include/vmparam.h Sun Jan 9 12:38:40 2011 (r217191) +++ head/sys/arm/include/vmparam.h Sun Jan 9 12:50:44 2011 (r217192) @@ -146,7 +146,6 @@ #define DFLSSIZ (2*1024*1024) #define MAXSSIZ (8*1024*1024) #define SGROWSIZ (128*1024) -#define MAXSLP 20 #ifdef ARM_USE_SMALL_ALLOC #define UMA_MD_SMALL_ALLOC Modified: head/sys/i386/include/vmparam.h ============================================================================== --- head/sys/i386/include/vmparam.h Sun Jan 9 12:38:40 2011 (r217191) +++ head/sys/i386/include/vmparam.h Sun Jan 9 12:50:44 2011 (r217192) @@ -64,18 +64,6 @@ #endif /* - * The time for a process to be blocked before being very swappable. - * This is a number of seconds which the system takes as being a non-trivial - * amount of real time. You probably shouldn't change this; - * it is used in subtle ways (fractions and multiples of it are, that is, like - * half of a ``long time'', almost a long time, etc.) - * It is related to human patience and other factors which don't really - * change over time. - */ -#define MAXSLP 20 - - -/* * The physical address space is densely populated. */ #define VM_PHYSSEG_DENSE Modified: head/sys/ia64/include/vmparam.h ============================================================================== --- head/sys/ia64/include/vmparam.h Sun Jan 9 12:38:40 2011 (r217191) +++ head/sys/ia64/include/vmparam.h Sun Jan 9 12:50:44 2011 (r217192) @@ -70,17 +70,6 @@ #endif /* - * The time for a process to be blocked before being very swappable. - * This is a number of seconds which the system takes as being a non-trivial - * amount of real time. You probably shouldn't change this; - * it is used in subtle ways (fractions and multiples of it are, that is, like - * half of a ``long time'', almost a long time, etc.) - * It is related to human patience and other factors which don't really - * change over time. - */ -#define MAXSLP 20 - -/* * We need region 7 virtual addresses for pagetables. */ #define UMA_MD_SMALL_ALLOC Modified: head/sys/mips/include/vmparam.h ============================================================================== --- head/sys/mips/include/vmparam.h Sun Jan 9 12:38:40 2011 (r217191) +++ head/sys/mips/include/vmparam.h Sun Jan 9 12:50:44 2011 (r217192) @@ -69,17 +69,6 @@ #define SGROWSIZ (128UL*1024) /* amount to grow stack */ #endif -/* - * The time for a process to be blocked before being very swappable. - * This is a number of seconds which the system takes as being a non-trivial - * amount of real time. You probably shouldn't change this; - * it is used in subtle ways (fractions and multiples of it are, that is, like - * half of a ``long time'', almost a long time, etc.) - * It is related to human patience and other factors which don't really - * change over time. - */ -#define MAXSLP 20 - /* * Mach derived constants */ Modified: head/sys/powerpc/include/vmparam.h ============================================================================== --- head/sys/powerpc/include/vmparam.h Sun Jan 9 12:38:40 2011 (r217191) +++ head/sys/powerpc/include/vmparam.h Sun Jan 9 12:50:44 2011 (r217192) @@ -58,17 +58,6 @@ #endif /* - * The time for a process to be blocked before being very swappable. - * This is a number of seconds which the system takes as being a non-trivial - * amount of real time. You probably shouldn't change this; - * it is used in subtle ways (fractions and multiples of it are, that is, like - * half of a ``long time'', almost a long time, etc.) - * It is related to human patience and other factors which don't really - * change over time. - */ -#define MAXSLP 20 - -/* * Would like to have MAX addresses = 0, but this doesn't (currently) work */ #if !defined(LOCORE) Modified: head/sys/sparc64/include/vmparam.h ============================================================================== --- head/sys/sparc64/include/vmparam.h Sun Jan 9 12:38:40 2011 (r217191) +++ head/sys/sparc64/include/vmparam.h Sun Jan 9 12:50:44 2011 (r217192) @@ -66,17 +66,6 @@ #endif /* - * The time for a process to be blocked before being very swappable. - * This is a number of seconds which the system takes as being a non-trivial - * amount of real time. You probably shouldn't change this; - * it is used in subtle ways (fractions and multiples of it are, that is, like - * half of a ``long time'', almost a long time, etc.) - * It is related to human patience and other factors which don't really - * change over time. - */ -#define MAXSLP 20 - -/* * The physical address space is sparsely populated. */ #define VM_PHYSSEG_SPARSE Modified: head/sys/sun4v/include/vmparam.h ============================================================================== --- head/sys/sun4v/include/vmparam.h Sun Jan 9 12:38:40 2011 (r217191) +++ head/sys/sun4v/include/vmparam.h Sun Jan 9 12:50:44 2011 (r217192) @@ -66,17 +66,6 @@ #endif /* - * The time for a process to be blocked before being very swappable. - * This is a number of seconds which the system takes as being a non-trivial - * amount of real time. You probably shouldn't change this; - * it is used in subtle ways (fractions and multiples of it are, that is, like - * half of a ``long time'', almost a long time, etc.) - * It is related to human patience and other factors which don't really - * change over time. - */ -#define MAXSLP 20 - -/* * The physical address space is densely populated. */ #define VM_PHYSSEG_DENSE Modified: head/sys/sys/vmmeter.h ============================================================================== --- head/sys/sys/vmmeter.h Sun Jan 9 12:38:40 2011 (r217191) +++ head/sys/sys/vmmeter.h Sun Jan 9 12:50:44 2011 (r217192) @@ -34,6 +34,12 @@ #define _SYS_VMMETER_H_ /* + * This value is used by ps(1) to change sleep state flag from 'S' to + * 'I' and by the sched process to set the alarm clock. + */ +#define MAXSLP 20 + +/* * System wide statistics counters. * Locking: * a - locked by atomic operations Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Sun Jan 9 12:38:40 2011 (r217191) +++ head/sys/vm/vm_glue.c Sun Jan 9 12:50:44 2011 (r217192) @@ -94,8 +94,6 @@ __FBSDID("$FreeBSD$"); #include #include -extern int maxslp; - /* * System initialization * @@ -770,7 +768,7 @@ loop: * Nothing to do, back to sleep. */ if ((p = pp) == NULL) { - tsleep(&proc0, PVM, "sched", maxslp * hz / 2); + tsleep(&proc0, PVM, "sched", MAXSLP * hz / 2); goto loop; } PROC_LOCK(p); @@ -819,12 +817,12 @@ SYSCTL_INT(_vm, OID_AUTO, swap_idle_thre &swap_idle_threshold2, 0, "Time before a process will be swapped out"); /* - * Swapout is driven by the pageout daemon. Very simple, we find eligible - * procs and swap out their stacks. We try to always "swap" at least one - * process in case we need the room for a swapin. - * If any procs have been sleeping/stopped for at least maxslp seconds, - * they are swapped. Else, we swap the longest-sleeping or stopped process, - * if any, otherwise the longest-resident process. + * First, if any processes have been sleeping or stopped for at least + * "swap_idle_threshold1" seconds, they are swapped out. If, however, + * no such processes exist, then the longest-sleeping or stopped + * process is swapped out. Finally, and only as a last resort, if + * there are no sleeping or stopped processes, the longest-resident + * process is swapped out. */ void swapout_procs(action) Modified: head/sys/vm/vm_meter.c ============================================================================== --- head/sys/vm/vm_meter.c Sun Jan 9 12:38:40 2011 (r217191) +++ head/sys/vm/vm_meter.c Sun Jan 9 12:50:44 2011 (r217192) @@ -54,8 +54,6 @@ __FBSDID("$FreeBSD$"); struct vmmeter cnt; -int maxslp = MAXSLP; - SYSCTL_UINT(_vm, VM_V_FREE_MIN, v_free_min, CTLFLAG_RW, &cnt.v_free_min, 0, ""); SYSCTL_UINT(_vm, VM_V_FREE_TARGET, v_free_target,