Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Oct 2012 14:02:51 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r242397 - stable/9/sys/vm
Message-ID:  <201210311402.q9VE2pMM056891@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Oct 31 14:02:51 2012
New Revision: 242397
URL: http://svn.freebsd.org/changeset/base/242397

Log:
  MFC r242011:
  Dirty the newly copied anonymous pages after the wired region is
  forked. Otherwise, pagedaemon might reclaim the page without saving
  its content into the swap file, resulting in the valid content
  replaced by zeroes.
  
  MFC r242012:
  Commit the actual text provided by Alan, instead of the wrong update
  in r242011.

Modified:
  stable/9/sys/vm/vm_fault.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/vm/vm_fault.c
==============================================================================
--- stable/9/sys/vm/vm_fault.c	Wed Oct 31 13:52:03 2012	(r242396)
+++ stable/9/sys/vm/vm_fault.c	Wed Oct 31 14:02:51 2012	(r242397)
@@ -1308,9 +1308,13 @@ vm_fault_copy_entry(vm_map_t dst_map, vm
 		access &= ~VM_PROT_WRITE;
 
 	/*
-	 * Loop through all of the pages in the entry's range, copying each
-	 * one from the source object (it should be there) to the destination
-	 * object.
+	 * Loop through all of the virtual pages within the entry's
+	 * range, copying each page from the source object to the
+	 * destination object.  Since the source is wired, those pages
+	 * must exist.  In contrast, the destination is pageable.
+	 * Since the destination object does share any backing storage
+	 * with the source object, all of its pages must be dirtied,
+	 * regardless of whether they can be written.
 	 */
 	for (vaddr = dst_entry->start, dst_pindex = 0;
 	    vaddr < dst_entry->end;
@@ -1353,6 +1357,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm
 		pmap_copy_page(src_m, dst_m);
 		VM_OBJECT_UNLOCK(object);
 		dst_m->valid = VM_PAGE_BITS_ALL;
+		dst_m->dirty = VM_PAGE_BITS_ALL;
 		VM_OBJECT_UNLOCK(dst_object);
 
 		/*



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