Changeset View
Changeset View
Standalone View
Standalone View
vm_glue.c
Context not available. | |||||
SYSCTL_INT(_vm, OID_AUTO, swap_idle_threshold2, CTLFLAG_RW, | 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"); | ||||
/* Long before Unix supported paging, it used process swapping. | |||||
* While this was ok with the PDP-11/20's 64kB address spaces, it does not work as well today | |||||
* when address spaces can easily be hundreds of GB.*/ | |||||
static u_long proc_swapout_max = 65536 ; | |||||
SYSCTL_LONG(_vm, OID_AUTO, proc_swapout_max, CTLFLAG_RW, &proc_swapout_max, 0, | |||||
"Allows to limit the swapout of whole processes which max resident size (in bytes) is equal or less than value"); | |||||
/* | /* | ||||
* First, if any processes have been sleeping or stopped for at least | * First, if any processes have been sleeping or stopped for at least | ||||
* "swap_idle_threshold1" seconds, they are swapped out. If, however, | * "swap_idle_threshold1" seconds, they are swapped out. If, however, | ||||
Context not available. | |||||
/* | /* | ||||
* If the pageout daemon didn't free enough pages, | * If the pageout daemon didn't free enough pages, | ||||
* or if this process is idle and the system is | * or if this process is idle and the system is | ||||
* configured to swap proactively, swap it out. | * configured to swap proactively, and the process resident count | ||||
* is less that vm.proc_swapout_max swap it out. | |||||
rpokala: I think this would read slightly better like this:
"If the pageout daemon didn't free enough… | |||||
*/ | */ | ||||
if ((action & VM_SWAP_NORMAL) || | if (((vmspace_resident_count(p->p_vmspace) * PAGE_SIZE) | ||||
<= proc_swapout_max ) && | |||||
((action & VM_SWAP_NORMAL) || | |||||
((action & VM_SWAP_IDLE) && | ((action & VM_SWAP_IDLE) && | ||||
(minslptime > swap_idle_threshold2))) { | (minslptime > swap_idle_threshold2)))) { | ||||
_PRELE(p); | _PRELE(p); | ||||
if (swapout(p) == 0) | if (swapout(p) == 0) | ||||
didswap++; | didswap++; | ||||
Context not available. | |||||
vm_map_unlock(&vm->vm_map); | vm_map_unlock(&vm->vm_map); | ||||
vmspace_free(vm); | vmspace_free(vm); | ||||
goto retry; | goto retry; | ||||
} | } | ||||
Done Inline ActionsThis change in indentation seems gratuitous, and also incorrect. rpokala: This change in indentation seems gratuitous, and also incorrect. | |||||
} | } | ||||
nextproc: | nextproc: | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
Context not available. | |||||
p->p_flag |= P_INMEM; | p->p_flag |= P_INMEM; | ||||
} | } | ||||
static int | static int | ||||
swapout(p) | swapout(p) | ||||
struct proc *p; | struct proc *p; | ||||
Context not available. |
I think this would read slightly better like this:
"If the pageout daemon didn't free enough pages, or if this process is idle, the system is configured to swap proactively, and the process resident count is less than vm.proc_swapout_max, swap it out."