aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>2014-05-13 13:20:23 +0000
committerAlan Cox <alc@FreeBSD.org>2014-05-13 13:20:23 +0000
commitafaa41f6b8d8ac534d4c3d195b18643f9539972b (patch)
treee6b99c46a7fe425046c1d7b130f9b045e5f061f5
parent74a034464e1a12ea02fd71a7054ee56da406ec67 (diff)
downloadsrc-afaa41f6b8d8ac534d4c3d195b18643f9539972b.tar.gz
src-afaa41f6b8d8ac534d4c3d195b18643f9539972b.zip
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
Notes
Notes: svn path=/head/; revision=265948
-rw-r--r--sys/vm/vm_map.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 3f46bcdba9a1..9dc655c13a56 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);