Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jun 2017 03:55:11 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r319934 - head/sys/dev/md
Message-ID:  <201706140355.v5E3tBBm057538@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 				}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706140355.v5E3tBBm057538>