From 4f8260e700b5765d95a10d02fa5cccd633ac0954 Mon Sep 17 00:00:00 2001 From: kib Date: Sun, 9 Jan 2011 12:50:44 +0000 Subject: 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 --- sys/amd64/include/vmparam.h | 11 ----------- sys/arm/include/vmparam.h | 1 - sys/i386/include/vmparam.h | 12 ------------ sys/ia64/include/vmparam.h | 11 ----------- sys/mips/include/vmparam.h | 11 ----------- sys/powerpc/include/vmparam.h | 11 ----------- sys/sparc64/include/vmparam.h | 11 ----------- sys/sun4v/include/vmparam.h | 11 ----------- sys/sys/vmmeter.h | 6 ++++++ sys/vm/vm_glue.c | 16 +++++++--------- sys/vm/vm_meter.c | 2 -- 11 files changed, 13 insertions(+), 90 deletions(-) (limited to 'sys') diff --git a/sys/amd64/include/vmparam.h b/sys/amd64/include/vmparam.h index 88d68b9..38a6214 100644 --- a/sys/amd64/include/vmparam.h +++ b/sys/amd64/include/vmparam.h @@ -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. diff --git a/sys/arm/include/vmparam.h b/sys/arm/include/vmparam.h index 23b0f86..c608daa 100644 --- a/sys/arm/include/vmparam.h +++ b/sys/arm/include/vmparam.h @@ -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 diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h index 2b159b6..e944810 100644 --- a/sys/i386/include/vmparam.h +++ b/sys/i386/include/vmparam.h @@ -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 diff --git a/sys/ia64/include/vmparam.h b/sys/ia64/include/vmparam.h index a827e01..edf5710 100644 --- a/sys/ia64/include/vmparam.h +++ b/sys/ia64/include/vmparam.h @@ -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 diff --git a/sys/mips/include/vmparam.h b/sys/mips/include/vmparam.h index 212a0c3..ef01601 100644 --- a/sys/mips/include/vmparam.h +++ b/sys/mips/include/vmparam.h @@ -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 */ diff --git a/sys/powerpc/include/vmparam.h b/sys/powerpc/include/vmparam.h index d98aea5..b92ce70 100644 --- a/sys/powerpc/include/vmparam.h +++ b/sys/powerpc/include/vmparam.h @@ -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) diff --git a/sys/sparc64/include/vmparam.h b/sys/sparc64/include/vmparam.h index 26caab3..fc581b3 100644 --- a/sys/sparc64/include/vmparam.h +++ b/sys/sparc64/include/vmparam.h @@ -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 diff --git a/sys/sun4v/include/vmparam.h b/sys/sun4v/include/vmparam.h index f4b24b5..ce01651 100644 --- a/sys/sun4v/include/vmparam.h +++ b/sys/sun4v/include/vmparam.h @@ -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 diff --git a/sys/sys/vmmeter.h b/sys/sys/vmmeter.h index 9d74611..99531a6 100644 --- a/sys/sys/vmmeter.h +++ b/sys/sys/vmmeter.h @@ -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 diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 0b9d92a..69576d5 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -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_threshold2, CTLFLAG_RW, &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) diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index 269de51..fb098ea 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -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, -- cgit v1.1