svn commit: r265886 - head/sys/vm
Alan Cox
alc at FreeBSD.org
Sun May 11 17:41:29 UTC 2014
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);
}
More information about the svn-src-head
mailing list