Optimize vm_object_page_remove() by eliminating pointless calls to

pmap_remove_all().  If the object to which a page belongs has no
references, then that page cannot possibly be mapped.

Reviewed by:	kib
MFC after:	1 week
This commit is contained in:
Alan Cox 2017-09-28 17:55:41 +00:00
parent 75b2ed47b7
commit cf060942db

View File

@ -1990,7 +1990,8 @@ again:
goto again;
}
if (p->wire_count != 0) {
if ((options & OBJPR_NOTMAPPED) == 0)
if ((options & OBJPR_NOTMAPPED) == 0 &&
object->ref_count != 0)
pmap_remove_all(p);
if ((options & OBJPR_CLEANONLY) == 0) {
p->valid = 0;
@ -2007,12 +2008,13 @@ again:
KASSERT((p->flags & PG_FICTITIOUS) == 0,
("vm_object_page_remove: page %p is fictitious", p));
if ((options & OBJPR_CLEANONLY) != 0 && p->valid != 0) {
if ((options & OBJPR_NOTMAPPED) == 0)
if ((options & OBJPR_NOTMAPPED) == 0 &&
object->ref_count != 0)
pmap_remove_write(p);
if (p->dirty)
if (p->dirty != 0)
continue;
}
if ((options & OBJPR_NOTMAPPED) == 0)
if ((options & OBJPR_NOTMAPPED) == 0 && object->ref_count != 0)
pmap_remove_all(p);
p->flags &= ~PG_ZERO;
if (vm_page_free_prep(p, false))