Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 May 2014 17:41:29 +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: r265886 - head/sys/vm
Message-ID:  <201405111741.s4BHfTXD095018@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Sun May 11 17:41:29 2014
New Revision: 265886
URL: http://svnweb.freebsd.org/changeset/base/265886

Log:
  With the new-and-improved vm_fault_copy_entry() (r265843), we can always
  avoid soft page faults when adding write access to user wired entries in
  vm_map_protect().  Previously, we only avoided the soft page fault when
  the underlying pages were copy-on-write.  In other words, we avoided the
  pages faults that might sleep on page allocation, but not the trivial
  page faults to update the physical map.
  
  Reviewed by:	kib
  MFC after:	1 week
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c	Sun May 11 17:28:57 2014	(r265885)
+++ head/sys/vm/vm_map.c	Sun May 11 17:41:29 2014	(r265886)
@@ -1978,10 +1978,17 @@ vm_map_protect(vm_map_t map, vm_offset_t
 		else
 			current->protection = new_prot;
 
-		if ((current->eflags & (MAP_ENTRY_COW | MAP_ENTRY_USER_WIRED))
-		     == (MAP_ENTRY_COW | MAP_ENTRY_USER_WIRED) &&
+		/*
+		 * For user wired map entries, the normal lazy evaluation of
+		 * write access upgrades through soft page faults is
+		 * undesirable.  Instead, immediately copy any pages that are
+		 * copy-on-write and enable write access in the physical map.
+		 */
+		if ((current->eflags & MAP_ENTRY_USER_WIRED) != 0 &&
 		    (current->protection & VM_PROT_WRITE) != 0 &&
 		    (old_prot & VM_PROT_WRITE) == 0) {
+			KASSERT(old_prot != VM_PROT_NONE,
+			    ("vm_map_protect: inaccessible wired map entry"));
 			vm_fault_copy_entry(map, map, current, current, NULL);
 		}
 



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