diff options
author | alc <alc@FreeBSD.org> | 2014-05-11 17:41:29 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2014-05-11 17:41:29 +0000 |
commit | b716a32dc28043696ea41352e7f21a45e54602af (patch) | |
tree | bce62cfdca4ad809039ed00d07ffc83447141983 /sys/vm | |
parent | a6ebcfc558864aa5250fb99f13caa1450d9dff01 (diff) | |
download | FreeBSD-src-b716a32dc28043696ea41352e7f21a45e54602af.zip FreeBSD-src-b716a32dc28043696ea41352e7f21a45e54602af.tar.gz |
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
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_map.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 0c95707..3f46bcd 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -1978,10 +1978,17 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_offset_t end, 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); } |