Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 May 2009 06:52:14 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192962 - head/sys/vm
Message-ID:  <200905280652.n4S6qEYn025966@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Thu May 28 06:52:14 2009
New Revision: 192962
URL: http://svn.freebsd.org/changeset/base/192962

Log:
  Revise vm_pageout_scan()'s handling of partially dirty pages.  Specifically,
  rather than unconditionally making partially dirty pages fully dirty, only
  make partially dirty pages fully dirty if the pmap says that the page has
  been modified.
  
  (This change is also a small optimization.  It eliminate an unnecessary call
  to pmap_is_modified() on pages that are mapped read only.)
  
  Suggested by:	tegge

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==============================================================================
--- head/sys/vm/vm_pageout.c	Thu May 28 06:39:11 2009	(r192961)
+++ head/sys/vm/vm_pageout.c	Thu May 28 06:52:14 2009	(r192962)
@@ -822,12 +822,13 @@ rescan0:
 		}
 
 		/*
-		 * If the upper level VM system doesn't know anything about 
-		 * the page being dirty, we have to check for it again.  As 
-		 * far as the VM code knows, any partially dirty pages are 
-		 * fully dirty.
+		 * If the upper level VM system does not believe that the page
+		 * is fully dirty, but it is mapped for write access, then we
+		 * consult the pmap to see if the page's dirty status should
+		 * be updated.
 		 */
-		if (m->dirty == 0 && !pmap_is_modified(m)) {
+		if (m->dirty != VM_PAGE_BITS_ALL &&
+		    (m->flags & PG_WRITEABLE) != 0) {
 			/*
 			 * Avoid a race condition: Unless write access is
 			 * removed from the page, another processor could
@@ -841,10 +842,10 @@ rescan0:
 			 * to the page, removing all access will be cheaper
 			 * overall.
 			 */
-			if ((m->flags & PG_WRITEABLE) != 0)
+			if (pmap_is_modified(m))
+				vm_page_dirty(m);
+			else if (m->dirty == 0)
 				pmap_remove_all(m);
-		} else {
-			vm_page_dirty(m);
 		}
 
 		if (m->valid == 0) {



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