diff options
author | alc <alc@FreeBSD.org> | 2014-05-13 13:20:23 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2014-05-13 13:20:23 +0000 |
commit | cf3c13370d943636a7b54be57e164459cf6e893e (patch) | |
tree | e6b99c46a7fe425046c1d7b130f9b045e5f061f5 /sys/vm/vm_map.c | |
parent | 88f7e0f645b955839b7b93ee55c43678bbf0f160 (diff) | |
download | FreeBSD-src-cf3c13370d943636a7b54be57e164459cf6e893e.zip FreeBSD-src-cf3c13370d943636a7b54be57e164459cf6e893e.tar.gz |
On a fork allow read-only wired pages to be copy-on-write shared between the
parent and child processes. Previously, we copied these pages even though
they are read only. However, the reason for copying them is historical and
no longer exists. In recent times, vm_map_protect() has developed the
ability to copy pages when write access is added to wired copy-on-write
pages. So, in this case, copy-on-write sharing of wired pages is not to be
feared. It is not going to lead to copy-on-write faults on wired memory.
Reviewed by: kib
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r-- | sys/vm/vm_map.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 3f46bcd..9dc655c 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -3024,8 +3024,8 @@ vm_map_copy_entry( if ((dst_entry->eflags|src_entry->eflags) & MAP_ENTRY_IS_SUB_MAP) return; - if (src_entry->wired_count == 0) { - + if (src_entry->wired_count == 0 || + (src_entry->protection & VM_PROT_WRITE) == 0) { /* * If the source entry is marked needs_copy, it is already * write-protected. @@ -3116,9 +3116,9 @@ vm_map_copy_entry( dst_entry->end - dst_entry->start, src_entry->start); } else { /* - * Of course, wired down pages can't be set copy-on-write. - * Cause wired pages to be copied into the new map by - * simulating faults (the new pages are pageable) + * We don't want to make writeable wired pages copy-on-write. + * Immediately copy these pages into the new map by simulating + * page faults. The new pages are pageable. */ vm_fault_copy_entry(dst_map, src_map, dst_entry, src_entry, fork_charge); |