vm_page_replace: remove redundant radix lookup
Remove redundant lookup of the old page from vm_page_replace. Verification that the old page exists is already done by vm_radix_replace. Submitted by: Ryan Libby <rlibby@gmail.com> Reviewed by: alc, kib Sponsored by: EMC / Isilon Storage Division Follow-up to: https://reviews.freebsd.org/D4326 Differential Revision: https://reviews.freebsd.org/D4471
This commit is contained in:
parent
62ac7dd2bf
commit
5e09bdc821
@ -1324,22 +1324,17 @@ vm_page_prev(vm_page_t m)
|
||||
vm_page_t
|
||||
vm_page_replace(vm_page_t mnew, vm_object_t object, vm_pindex_t pindex)
|
||||
{
|
||||
vm_page_t mold, mpred;
|
||||
vm_page_t mold;
|
||||
|
||||
VM_OBJECT_ASSERT_WLOCKED(object);
|
||||
KASSERT(mnew->object == NULL,
|
||||
("vm_page_replace: page already in object"));
|
||||
|
||||
/*
|
||||
* This function mostly follows vm_page_insert() and
|
||||
* vm_page_remove() without the radix, object count and vnode
|
||||
* dance. Double check such functions for more comments.
|
||||
*/
|
||||
mpred = vm_radix_lookup(&object->rtree, pindex);
|
||||
KASSERT(mpred != NULL,
|
||||
("vm_page_replace: replacing page not present with pindex"));
|
||||
mpred = TAILQ_PREV(mpred, respgs, listq);
|
||||
if (mpred != NULL)
|
||||
KASSERT(mpred->pindex < pindex,
|
||||
("vm_page_insert_after: mpred doesn't precede pindex"));
|
||||
|
||||
mnew->object = object;
|
||||
mnew->pindex = pindex;
|
||||
@ -1347,17 +1342,17 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm_pindex_t pindex)
|
||||
KASSERT(mold->queue == PQ_NONE,
|
||||
("vm_page_replace: mold is on a paging queue"));
|
||||
|
||||
/* Detach the old page from the resident tailq. */
|
||||
/* Keep the resident page list in sorted order. */
|
||||
TAILQ_INSERT_AFTER(&object->memq, mold, mnew, listq);
|
||||
TAILQ_REMOVE(&object->memq, mold, listq);
|
||||
|
||||
mold->object = NULL;
|
||||
vm_page_xunbusy(mold);
|
||||
|
||||
/* Insert the new page in the resident tailq. */
|
||||
if (mpred != NULL)
|
||||
TAILQ_INSERT_AFTER(&object->memq, mpred, mnew, listq);
|
||||
else
|
||||
TAILQ_INSERT_HEAD(&object->memq, mnew, listq);
|
||||
/*
|
||||
* The object's resident_page_count does not change because we have
|
||||
* swapped one page for another, but OBJ_MIGHTBEDIRTY.
|
||||
*/
|
||||
if (pmap_page_is_write_mapped(mnew))
|
||||
vm_object_set_writeable_dirty(object);
|
||||
return (mold);
|
||||
|
Loading…
x
Reference in New Issue
Block a user