Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/swap_pager.c
Show First 20 Lines • Show All 991 Lines • ▼ Show 20 Lines | |||||
nblks = sp->sw_nblks; | nblks = sp->sw_nblks; | ||||
/* | /* | ||||
* We can turn off this swap device safely only if the | * We can turn off this swap device safely only if the | ||||
* available virtual memory in the system will fit the amount | * available virtual memory in the system will fit the amount | ||||
* of data we will have to page back in, plus an epsilon so | * of data we will have to page back in, plus an epsilon so | ||||
* the system doesn't become critically low on swap space. | * the system doesn't become critically low on swap space. | ||||
*/ | */ | ||||
if (vm_cnt.v_free_count + swap_pager_avail < nblks + nswap_lowat) | if (vm_free_count() + swap_pager_avail < nblks + nswap_lowat) | ||||
return (ENOMEM); | return (ENOMEM); | ||||
/* | /* | ||||
* Prevent further allocations on this device. | * Prevent further allocations on this device. | ||||
*/ | */ | ||||
mtx_lock(&sw_dev_mtx); | mtx_lock(&sw_dev_mtx); | ||||
sp->sw_flags |= SW_CLOSING; | sp->sw_flags |= SW_CLOSING; | ||||
swap_pager_avail -= blist_fill(sp->sw_blist, 0, nblks); | swap_pager_avail -= blist_fill(sp->sw_blist, 0, nblks); | ||||
▲ Show 20 Lines • Show All 543 Lines • Show Last 20 Lines |