aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>2004-08-09 06:01:46 +0000
committerAlan Cox <alc@FreeBSD.org>2004-08-09 06:01:46 +0000
commiteebf3286a6cf53a1cbb77626a5b2d9d17555a2ac (patch)
tree05b8e4e666b5deb0579ee9d750755ce73a716806
parent6141e04a7e4015e57a61ab5724aa53bb9a9820b8 (diff)
downloadsrc-eebf3286a6cf53a1cbb77626a5b2d9d17555a2ac.tar.gz
src-eebf3286a6cf53a1cbb77626a5b2d9d17555a2ac.zip
Make two changes to vm_fault().
1. Retain the map lock until after the calls to pmap_enter() and vm_fault_prefault(). 2. Remove a stale comment. Submitted by: tegge@
Notes
Notes: svn path=/head/; revision=133355
-rw-r--r--sys/vm/vm_fault.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index 562d255f0b9f..5c9f8cf323aa 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -771,11 +771,6 @@ readrest:
vm_prot_t retry_prot;
/*
- * Since map entries may be pageable, make sure we can take a
- * page fault on them.
- */
-
- /*
* Unlock vnode before the lookup to avoid deadlock. E.G.
* avoid a deadlock between the inode and exec_map that can
* occur due to locks being obtained in different orders.
@@ -890,13 +885,13 @@ readrest:
vm_page_zero_invalid(fs.m, TRUE);
printf("Warning: page %p partially invalid on fault\n", fs.m);
}
- unlock_things(&fs);
+ VM_OBJECT_UNLOCK(fs.object);
pmap_enter(fs.map->pmap, vaddr, fs.m, prot, wired);
if (((fault_flags & VM_FAULT_WIRE_MASK) == 0) && (wired == 0)) {
vm_fault_prefault(fs.map->pmap, vaddr, fs.entry);
}
- mtx_unlock(&Giant);
+ VM_OBJECT_LOCK(fs.object);
vm_page_lock_queues();
vm_page_flag_set(fs.m, PG_REFERENCED);
@@ -915,6 +910,10 @@ readrest:
vm_page_wakeup(fs.m);
vm_page_unlock_queues();
+ /*
+ * Unlock everything, and return
+ */
+ unlock_and_deallocate(&fs);
PROC_LOCK(curproc);
if ((curproc->p_sflag & PS_INMEM) && curproc->p_stats) {
if (hardfault) {
@@ -925,10 +924,6 @@ readrest:
}
PROC_UNLOCK(curproc);
- /*
- * Unlock everything, and return
- */
- vm_object_deallocate(fs.first_object);
return (KERN_SUCCESS);
}