Change the order of lock reacquisition in vm_object_split() in order to

simplify the code slightly.  Add a comment concerning lock ordering.
This commit is contained in:
Alan Cox 2007-03-22 07:02:43 +00:00
parent 8f27b08e87
commit c5474b8f18
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167795

View file

@ -1308,6 +1308,10 @@ vm_object_split(vm_map_entry_t entry)
*/
new_object = vm_object_allocate(OBJT_DEFAULT, size);
/*
* At this point, the new object is still private, so the order in
* which the original and new objects are locked does not matter.
*/
VM_OBJECT_LOCK(new_object);
VM_OBJECT_LOCK(orig_object);
source = orig_object->backing_object;
@ -1350,9 +1354,8 @@ vm_object_split(vm_map_entry_t entry)
vm_page_unlock_queues();
VM_OBJECT_UNLOCK(new_object);
m->oflags |= VPO_WANTED;
msleep(m, VM_OBJECT_MTX(orig_object), PDROP | PVM, "spltwt", 0);
msleep(m, VM_OBJECT_MTX(orig_object), PVM, "spltwt", 0);
VM_OBJECT_LOCK(new_object);
VM_OBJECT_LOCK(orig_object);
goto retry;
}
vm_page_rename(m, new_object, idx);