summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2003-09-07 18:47:54 +0000
committeralc <alc@FreeBSD.org>2003-09-07 18:47:54 +0000
commit1cb490a309213e170d8bbacf58e2df6df6478622 (patch)
treed818ff644d485048e5639f36683f8fdc5c6d3ed2
parent8f5e31de0a4e03de2709c8e9d487bf398f9ac709 (diff)
downloadFreeBSD-src-1cb490a309213e170d8bbacf58e2df6df6478622.zip
FreeBSD-src-1cb490a309213e170d8bbacf58e2df6df6478622.tar.gz
Revise the locking in mincore(2).
-rw-r--r--sys/vm/vm_mmap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index b8188e4..d38a631 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -845,7 +845,6 @@ mincore(td, uap)
*/
vec = uap->vec;
- mtx_lock(&Giant);
pmap = vmspace_pmap(td->td_proc->p_vmspace);
vm_map_lock_read(map);
@@ -891,7 +890,9 @@ RestartScan:
* it can provide info as to whether we are the
* one referencing or modifying the page.
*/
+ mtx_lock(&Giant);
mincoreinfo = pmap_mincore(pmap, addr);
+ mtx_unlock(&Giant);
if (!mincoreinfo) {
vm_pindex_t pindex;
vm_ooffset_t offset;
@@ -904,14 +905,13 @@ RestartScan:
VM_OBJECT_LOCK(current->object.vm_object);
m = vm_page_lookup(current->object.vm_object,
pindex);
- VM_OBJECT_UNLOCK(current->object.vm_object);
- vm_page_lock_queues();
/*
* if the page is resident, then gather information about
* it.
*/
if (m) {
mincoreinfo = MINCORE_INCORE;
+ vm_page_lock_queues();
if (m->dirty ||
pmap_is_modified(m))
mincoreinfo |= MINCORE_MODIFIED_OTHER;
@@ -920,8 +920,9 @@ RestartScan:
vm_page_flag_set(m, PG_REFERENCED);
mincoreinfo |= MINCORE_REFERENCED_OTHER;
}
+ vm_page_unlock_queues();
}
- vm_page_unlock_queues();
+ VM_OBJECT_UNLOCK(current->object.vm_object);
}
/*
@@ -998,7 +999,6 @@ RestartScan:
goto RestartScan;
vm_map_unlock_read(map);
done2:
- mtx_unlock(&Giant);
return (error);
}
OpenPOWER on IntegriCloud