svn commit: r319934 - head/sys/dev/md
Mark Johnston
markj at FreeBSD.org
Wed Jun 14 03:55:13 UTC 2017
Author: markj
Date: Wed Jun 14 03:55:11 2017
New Revision: 319934
URL: https://svnweb.freebsd.org/changeset/base/319934
Log:
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
Modified:
head/sys/dev/md/md.c
Modified: head/sys/dev/md/md.c
==============================================================================
--- head/sys/dev/md/md.c Wed Jun 14 03:50:02 2017 (r319933)
+++ head/sys/dev/md/md.c Wed Jun 14 03:55:11 2017 (r319934)
@@ -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;
}
More information about the svn-src-all
mailing list