Batch freeing of the pages in vm_object_page_remove() under the same

free queue mutex lock owning session, same as it was done for the
object termination in r323561.

Reported and tested by:	mjg
Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
kib 2017-09-15 16:07:09 +00:00
parent cbbf68b0da
commit 4c4cbd798b

View File

@ -1953,6 +1953,7 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t start, vm_pindex_t end,
{
vm_page_t p, next;
struct mtx *mtx;
struct pglist pgl;
VM_OBJECT_ASSERT_WLOCKED(object);
KASSERT((object->flags & OBJ_UNMANAGED) == 0 ||
@ -1961,6 +1962,7 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t start, vm_pindex_t end,
if (object->resident_page_count == 0)
return;
vm_object_pip_add(object, 1);
TAILQ_INIT(&pgl);
again:
p = vm_page_find_least(object, start);
mtx = NULL;
@ -2012,10 +2014,13 @@ again:
}
if ((options & OBJPR_NOTMAPPED) == 0)
pmap_remove_all(p);
vm_page_free(p);
p->flags &= ~PG_ZERO;
if (vm_page_free_prep(p, false))
TAILQ_INSERT_TAIL(&pgl, p, listq);
}
if (mtx != NULL)
mtx_unlock(mtx);
vm_page_free_phys_pglist(&pgl);
vm_object_pip_wakeup(object);
}