Date: Tue, 13 May 2014 13:20:23 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265948 - head/sys/vm Message-ID: <201405131320.s4DDKNt4084152@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Tue May 13 13:20:23 2014 New Revision: 265948 URL: http://svnweb.freebsd.org/changeset/base/265948 Log: 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 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Tue May 13 06:09:01 2014 (r265947) +++ head/sys/vm/vm_map.c Tue May 13 13:20:23 2014 (r265948) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405131320.s4DDKNt4084152>