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
This commit is contained in:
Konstantin Belousov 2011-01-09 12:50:44 +00:00
parent da2fcff746
commit 50a57dfbec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=217192
12 changed files with 14 additions and 90 deletions

View File

@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mac.h> #include <sys/mac.h>
#include <sys/user.h> #include <sys/user.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/vmmeter.h>
#include <err.h> #include <err.h>
#include <grp.h> #include <grp.h>

View File

@ -69,17 +69,6 @@
#define SGROWSIZ (128UL*1024) /* amount to grow stack */ #define SGROWSIZ (128UL*1024) /* amount to grow stack */
#endif #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 * We provide a machine specific single page allocator through the use
* of the direct mapped segment. This uses 2MB pages for reduced * of the direct mapped segment. This uses 2MB pages for reduced

View File

@ -146,7 +146,6 @@
#define DFLSSIZ (2*1024*1024) #define DFLSSIZ (2*1024*1024)
#define MAXSSIZ (8*1024*1024) #define MAXSSIZ (8*1024*1024)
#define SGROWSIZ (128*1024) #define SGROWSIZ (128*1024)
#define MAXSLP 20
#ifdef ARM_USE_SMALL_ALLOC #ifdef ARM_USE_SMALL_ALLOC
#define UMA_MD_SMALL_ALLOC #define UMA_MD_SMALL_ALLOC

View File

@ -63,18 +63,6 @@
#define SGROWSIZ (128UL*1024) /* amount to grow stack */ #define SGROWSIZ (128UL*1024) /* amount to grow stack */
#endif #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. * The physical address space is densely populated.
*/ */

View File

@ -69,17 +69,6 @@
#define SGROWSIZ (128UL*1024) /* amount to grow stack */ #define SGROWSIZ (128UL*1024) /* amount to grow stack */
#endif #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. * We need region 7 virtual addresses for pagetables.
*/ */

View File

@ -69,17 +69,6 @@
#define SGROWSIZ (128UL*1024) /* amount to grow stack */ #define SGROWSIZ (128UL*1024) /* amount to grow stack */
#endif #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 * Mach derived constants
*/ */

View File

@ -57,17 +57,6 @@
#define MAXSSIZ (64*1024*1024) /* max stack size */ #define MAXSSIZ (64*1024*1024) /* max stack size */
#endif #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 * Would like to have MAX addresses = 0, but this doesn't (currently) work
*/ */

View File

@ -65,17 +65,6 @@
#define SGROWSIZ (128*1024) /* amount to grow stack */ #define SGROWSIZ (128*1024) /* amount to grow stack */
#endif #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. * The physical address space is sparsely populated.
*/ */

View File

@ -65,17 +65,6 @@
#define SGROWSIZ (128*1024) /* amount to grow stack */ #define SGROWSIZ (128*1024) /* amount to grow stack */
#endif #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. * The physical address space is densely populated.
*/ */

View File

@ -33,6 +33,12 @@
#ifndef _SYS_VMMETER_H_ #ifndef _SYS_VMMETER_H_
#define _SYS_VMMETER_H_ #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. * System wide statistics counters.
* Locking: * Locking:

View File

@ -94,8 +94,6 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_pager.h> #include <vm/vm_pager.h>
#include <vm/swap_pager.h> #include <vm/swap_pager.h>
extern int maxslp;
/* /*
* System initialization * System initialization
* *
@ -770,7 +768,7 @@ scheduler(dummy)
* Nothing to do, back to sleep. * Nothing to do, back to sleep.
*/ */
if ((p = pp) == NULL) { if ((p = pp) == NULL) {
tsleep(&proc0, PVM, "sched", maxslp * hz / 2); tsleep(&proc0, PVM, "sched", MAXSLP * hz / 2);
goto loop; goto loop;
} }
PROC_LOCK(p); 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"); &swap_idle_threshold2, 0, "Time before a process will be swapped out");
/* /*
* Swapout is driven by the pageout daemon. Very simple, we find eligible * First, if any processes have been sleeping or stopped for at least
* procs and swap out their stacks. We try to always "swap" at least one * "swap_idle_threshold1" seconds, they are swapped out. If, however,
* process in case we need the room for a swapin. * no such processes exist, then the longest-sleeping or stopped
* If any procs have been sleeping/stopped for at least maxslp seconds, * process is swapped out. Finally, and only as a last resort, if
* they are swapped. Else, we swap the longest-sleeping or stopped process, * there are no sleeping or stopped processes, the longest-resident
* if any, otherwise the longest-resident process. * process is swapped out.
*/ */
void void
swapout_procs(action) swapout_procs(action)

View File

@ -54,8 +54,6 @@ __FBSDID("$FreeBSD$");
struct vmmeter cnt; struct vmmeter cnt;
int maxslp = MAXSLP;
SYSCTL_UINT(_vm, VM_V_FREE_MIN, v_free_min, SYSCTL_UINT(_vm, VM_V_FREE_MIN, v_free_min,
CTLFLAG_RW, &cnt.v_free_min, 0, ""); CTLFLAG_RW, &cnt.v_free_min, 0, "");
SYSCTL_UINT(_vm, VM_V_FREE_TARGET, v_free_target, SYSCTL_UINT(_vm, VM_V_FREE_TARGET, v_free_target,