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
This commit is contained in:
parent
30238f4963
commit
dd006a1b14
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user