summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2003-06-21 06:31:42 +0000
committeralc <alc@FreeBSD.org>2003-06-21 06:31:42 +0000
commited79b4d6257cb411589c447a07a268c99e8b345d (patch)
tree32cbd2da12ff9833e297fb9c1da08abd66667dd5 /sys/vm
parent0303355ccc1c33ff898663363f9804209b0593ef (diff)
downloadFreeBSD-src-ed79b4d6257cb411589c447a07a268c99e8b345d.zip
FreeBSD-src-ed79b4d6257cb411589c447a07a268c99e8b345d.tar.gz
Lock one of the vm objects involved in an optimized copy-on-write fault.
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_fault.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index cc138c3..fcb2426 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -196,7 +196,7 @@ vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type,
int fault_flags)
{
vm_prot_t prot;
- int result;
+ int is_first_object_locked, result;
boolean_t growstack, wired;
int map_generation;
vm_object_t next_object;
@@ -683,6 +683,7 @@ readrest:
* dirty in the first object so that it will go out
* to swap when needed.
*/
+ is_first_object_locked = FALSE;
if (
/*
* Only one shadow object
@@ -701,6 +702,7 @@ readrest:
*/
((fs.object->type == OBJT_DEFAULT) ||
(fs.object->type == OBJT_SWAP)) &&
+ (is_first_object_locked = VM_OBJECT_TRYLOCK(fs.first_object)) &&
/*
* We don't chase down the shadow chain
*/
@@ -730,7 +732,8 @@ readrest:
*/
vm_page_copy(fs.m, fs.first_m);
}
-
+ if (is_first_object_locked)
+/*XXX*/ VM_OBJECT_UNLOCK(fs.first_object);
if (fs.m) {
/*
* We no longer need the old page or object.
OpenPOWER on IntegriCloud