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/vm/vm_glue.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'sys/vm/vm_glue.c') 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) -- cgit v1.1