Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jan 2011 12:50:44 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
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
Message-ID:  <201101091250.p09CoiTI043253@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <sys/mac.h>
 #include <sys/user.h>
 #include <sys/sysctl.h>
+#include <sys/vmmeter.h>
 
 #include <err.h>
 #include <grp.h>

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 <vm/vm_pager.h>
 #include <vm/swap_pager.h>
 
-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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101091250.p09CoiTI043253>