Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_pageout.c
Show First 20 Lines • Show All 1,116 Lines • ▼ Show 20 Lines | dolaundry: | ||||
/* | /* | ||||
* If the pagedaemon has indicated that it's in shortfall, start | * If the pagedaemon has indicated that it's in shortfall, start | ||||
* a shortfall laundering unless we're already in the middle of | * a shortfall laundering unless we're already in the middle of | ||||
* one. This may preempt a background laundering. | * one. This may preempt a background laundering. | ||||
*/ | */ | ||||
if (vmd->vmd_laundry_request == VM_LAUNDRY_SHORTFALL && | if (vmd->vmd_laundry_request == VM_LAUNDRY_SHORTFALL && | ||||
(!in_shortfall || shortfall_cycle == 0)) { | (!in_shortfall || shortfall_cycle == 0)) { | ||||
shortfall = vm_laundry_target(vmd) + | shortfall = vm_laundry_target(vmd) + | ||||
vmd->vmd_pageout_deficit; | atomic_load_int(&vmd->vmd_shortage); | ||||
target = 0; | target = 0; | ||||
} else | } else | ||||
shortfall = 0; | shortfall = 0; | ||||
if (target == 0) | if (target == 0) | ||||
vmd->vmd_laundry_request = VM_LAUNDRY_IDLE; | vmd->vmd_laundry_request = VM_LAUNDRY_IDLE; | ||||
nfreed += vmd->vmd_clean_pages_freed; | nfreed += vmd->vmd_clean_pages_freed; | ||||
vmd->vmd_clean_pages_freed = 0; | vmd->vmd_clean_pages_freed = 0; | ||||
▲ Show 20 Lines • Show All 924 Lines • ▼ Show 20 Lines | while (TRUE) { | ||||
/* | /* | ||||
* Use the controller to calculate how many pages to free in | * Use the controller to calculate how many pages to free in | ||||
* this interval, and scan the inactive queue. If the lowmem | * this interval, and scan the inactive queue. If the lowmem | ||||
* handlers appear to have freed up some pages, subtract the | * handlers appear to have freed up some pages, subtract the | ||||
* difference from the inactive queue scan target. | * difference from the inactive queue scan target. | ||||
*/ | */ | ||||
shortage = pidctrl_daemon(&vmd->vmd_pid, vmd->vmd_free_count); | shortage = pidctrl_daemon(&vmd->vmd_pid, vmd->vmd_free_count); | ||||
if (shortage > 0) { | if (shortage > 0) { | ||||
atomic_store_int(&vmd->vmd_shortage, shortage); | |||||
ofree = vmd->vmd_free_count; | ofree = vmd->vmd_free_count; | ||||
if (vm_pageout_lowmem() && vmd->vmd_free_count > ofree) | if (vm_pageout_lowmem() && vmd->vmd_free_count > ofree) | ||||
shortage -= min(vmd->vmd_free_count - ofree, | shortage -= min(vmd->vmd_free_count - ofree, | ||||
(u_int)shortage); | (u_int)shortage); | ||||
target_met = vm_pageout_scan_inactive(vmd, shortage, | target_met = vm_pageout_scan_inactive(vmd, shortage, | ||||
&addl_shortage); | &addl_shortage); | ||||
} else | } else { | ||||
atomic_store_int(&vmd->vmd_shortage, 0); | |||||
addl_shortage = 0; | addl_shortage = 0; | ||||
} | |||||
/* | /* | ||||
* Scan the active queue. A positive value for shortage | * Scan the active queue. A positive value for shortage | ||||
* indicates that we must aggressively deactivate pages to avoid | * indicates that we must aggressively deactivate pages to avoid | ||||
* a shortfall. | * a shortfall. | ||||
*/ | */ | ||||
shortage = vm_pageout_active_target(vmd) + addl_shortage; | shortage = vm_pageout_active_target(vmd) + addl_shortage; | ||||
vm_pageout_scan_active(vmd, shortage); | vm_pageout_scan_active(vmd, shortage); | ||||
▲ Show 20 Lines • Show All 162 Lines • Show Last 20 Lines |