1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00

- Simplify VM code by using vmspace_wired_count() for counting wired

memory of a process.

Reviewed by:	avg
Approved by:	kib (mentor)
MFC after:	2 weeks
This commit is contained in:
Andrey Zonov 2012-09-05 18:19:54 +00:00
parent b8c0bcd29e
commit c4e357e8d3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240145

View File

@ -1050,8 +1050,7 @@ sys_mlock(td, uap)
return (ENOMEM); return (ENOMEM);
proc = td->td_proc; proc = td->td_proc;
PROC_LOCK(proc); PROC_LOCK(proc);
nsize = ptoa(npages + nsize = ptoa(npages + vmspace_wired_count(proc->p_vmspace));
pmap_wired_count(vm_map_pmap(&proc->p_vmspace->vm_map)));
if (nsize > lim_cur(proc, RLIMIT_MEMLOCK)) { if (nsize > lim_cur(proc, RLIMIT_MEMLOCK)) {
PROC_UNLOCK(proc); PROC_UNLOCK(proc);
return (ENOMEM); return (ENOMEM);
@ -1072,7 +1071,7 @@ sys_mlock(td, uap)
if (error != KERN_SUCCESS) { if (error != KERN_SUCCESS) {
PROC_LOCK(proc); PROC_LOCK(proc);
racct_set(proc, RACCT_MEMLOCK, racct_set(proc, RACCT_MEMLOCK,
ptoa(pmap_wired_count(vm_map_pmap(&proc->p_vmspace->vm_map)))); ptoa(vmspace_wired_count(proc->p_vmspace)));
PROC_UNLOCK(proc); PROC_UNLOCK(proc);
} }
#endif #endif
@ -1148,7 +1147,7 @@ sys_mlockall(td, uap)
if (error != KERN_SUCCESS) { if (error != KERN_SUCCESS) {
PROC_LOCK(td->td_proc); PROC_LOCK(td->td_proc);
racct_set(td->td_proc, RACCT_MEMLOCK, racct_set(td->td_proc, RACCT_MEMLOCK,
ptoa(pmap_wired_count(vm_map_pmap(&td->td_proc->p_vmspace->vm_map)))); ptoa(vmspace_wired_count(td->td_proc->p_vmspace)));
PROC_UNLOCK(td->td_proc); PROC_UNLOCK(td->td_proc);
} }
#endif #endif