Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/swap_pager.c
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | swap_reserve_by_cred(vm_ooffset_t incr, struct ucred *cred) | ||||
struct uidinfo *uip; | struct uidinfo *uip; | ||||
uip = cred->cr_ruidinfo; | uip = cred->cr_ruidinfo; | ||||
if (incr & PAGE_MASK) | if (incr & PAGE_MASK) | ||||
panic("swap_reserve: & PAGE_MASK"); | panic("swap_reserve: & PAGE_MASK"); | ||||
#ifdef RACCT | #ifdef RACCT | ||||
if (racct_enable) { | |||||
PROC_LOCK(curproc); | PROC_LOCK(curproc); | ||||
error = racct_add(curproc, RACCT_SWAP, incr); | error = racct_add(curproc, RACCT_SWAP, incr); | ||||
PROC_UNLOCK(curproc); | PROC_UNLOCK(curproc); | ||||
if (error != 0) | if (error != 0) | ||||
return (0); | return (0); | ||||
} | |||||
#endif | #endif | ||||
res = 0; | res = 0; | ||||
mtx_lock(&sw_dev_mtx); | mtx_lock(&sw_dev_mtx); | ||||
r = swap_reserved + incr; | r = swap_reserved + incr; | ||||
if (overcommit & SWAP_RESERVE_ALLOW_NONWIRED) { | if (overcommit & SWAP_RESERVE_ALLOW_NONWIRED) { | ||||
s = vm_cnt.v_page_count - vm_cnt.v_free_reserved - vm_cnt.v_wire_count; | s = vm_cnt.v_page_count - vm_cnt.v_free_reserved - vm_cnt.v_wire_count; | ||||
s *= PAGE_SIZE; | s *= PAGE_SIZE; | ||||
▲ Show 20 Lines • Show All 2,622 Lines • Show Last 20 Lines |