Use vm_page_replace_checked() instead of vm_page_rename() for implementing
optimized copy-on-write faults. This has two advantages: (1) one less radix tree operation is performed and (2) vm_page_replace_checked() cannot fail, making the code simpler. Submitted by: Ryan Libby Reviewed by: kib Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D4478
This commit is contained in:
parent
a8362fc737
commit
bccdea450b
@ -799,26 +799,15 @@ vnode_locked:
|
|||||||
* We don't chase down the shadow chain
|
* We don't chase down the shadow chain
|
||||||
*/
|
*/
|
||||||
fs.object == fs.first_object->backing_object) {
|
fs.object == fs.first_object->backing_object) {
|
||||||
/*
|
vm_page_lock(fs.m);
|
||||||
* get rid of the unnecessary page
|
vm_page_remove(fs.m);
|
||||||
*/
|
vm_page_unlock(fs.m);
|
||||||
vm_page_lock(fs.first_m);
|
|
||||||
vm_page_remove(fs.first_m);
|
|
||||||
vm_page_unlock(fs.first_m);
|
|
||||||
/*
|
|
||||||
* grab the page and put it into the
|
|
||||||
* process'es object. The page is
|
|
||||||
* automatically made dirty.
|
|
||||||
*/
|
|
||||||
if (vm_page_rename(fs.m, fs.first_object,
|
|
||||||
fs.first_pindex)) {
|
|
||||||
VM_OBJECT_WUNLOCK(fs.first_object);
|
|
||||||
unlock_and_deallocate(&fs);
|
|
||||||
goto RetryFault;
|
|
||||||
}
|
|
||||||
vm_page_lock(fs.first_m);
|
vm_page_lock(fs.first_m);
|
||||||
|
vm_page_replace_checked(fs.m, fs.first_object,
|
||||||
|
fs.first_pindex, fs.first_m);
|
||||||
vm_page_free(fs.first_m);
|
vm_page_free(fs.first_m);
|
||||||
vm_page_unlock(fs.first_m);
|
vm_page_unlock(fs.first_m);
|
||||||
|
vm_page_dirty(fs.m);
|
||||||
#if VM_NRESERVLEVEL > 0
|
#if VM_NRESERVLEVEL > 0
|
||||||
/*
|
/*
|
||||||
* Rename the reservation.
|
* Rename the reservation.
|
||||||
@ -827,6 +816,10 @@ vnode_locked:
|
|||||||
fs.object, OFF_TO_IDX(
|
fs.object, OFF_TO_IDX(
|
||||||
fs.first_object->backing_object_offset));
|
fs.first_object->backing_object_offset));
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
|
* Removing the page from the backing object
|
||||||
|
* unbusied it.
|
||||||
|
*/
|
||||||
vm_page_xbusy(fs.m);
|
vm_page_xbusy(fs.m);
|
||||||
fs.first_m = fs.m;
|
fs.first_m = fs.m;
|
||||||
fs.m = NULL;
|
fs.m = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user