Don't call vm_pager_page_unswapped() when writing or deleting a dirty page.

The swap space backing a clean page is released when it is first dirtied,
so there's no need to attempt to release swap space when the page is
already dirty.

Reviewed by:	alc
MFC after:	1 week
This commit is contained in:
Mark Johnston 2017-06-14 03:55:11 +00:00
parent 01bc16bb0e
commit 0d48e7e839

View File

@ -1076,8 +1076,10 @@ mdstart_swap(struct md_s *sc, struct bio *bp)
}
m->valid = VM_PAGE_BITS_ALL;
vm_page_dirty(m);
vm_pager_page_unswapped(m);
if (m->dirty != VM_PAGE_BITS_ALL) {
vm_page_dirty(m);
vm_pager_page_unswapped(m);
}
} else if (bp->bio_cmd == BIO_DELETE) {
if (len == PAGE_SIZE || m->valid == VM_PAGE_BITS_ALL)
rv = VM_PAGER_OK;
@ -1094,10 +1096,12 @@ mdstart_swap(struct md_s *sc, struct bio *bp)
/* Page is valid. */
if (len != PAGE_SIZE) {
pmap_zero_page_area(m, offs, len);
vm_page_dirty(m);
}
vm_pager_page_unswapped(m);
if (len == PAGE_SIZE) {
if (m->dirty != VM_PAGE_BITS_ALL) {
vm_page_dirty(m);
vm_pager_page_unswapped(m);
}
} else {
vm_pager_page_unswapped(m);
md_swap_page_free(m);
m = NULL;
}