]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
For the upgrade case in vm_fault_copy_entry(), when the entry does not
authorKonstantin Belousov <kib@FreeBSD.org>
Sat, 10 May 2014 17:03:33 +0000 (17:03 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Sat, 10 May 2014 17:03:33 +0000 (17:03 +0000)
commit0973283d6e0c5f59f02b690ec7084ece0d86bd14
tree6cf8b7c8737b89e6740bb4a8b78894493648e030
parentb17de684ba85f679a41a134e1954458c679f58fe
For the upgrade case in vm_fault_copy_entry(), when the entry does not
need COW and is writeable (i.e. becoming writeable due to the
mprotect(2) operation), do not create a new backing object for the
entry.  The caller of the function is vm_map_protect(), the call is
made to ensure that wired entry has all pages resident and wired in
the top level object and to enable the write.  We might need to copy
read-only page from some backing objects into the top object or remap
the page with the write allowed.

This fixes the issue with mishandling of the swap accounting when
read-only wired mapping is upgraded to write-enabled after fork.  The
previous code path did not accounted the new object, but it creation
is redundand anyway and the change provides an optimization for the
non-common situation.

Reported by: markj
Suggested and reviewed by: alc (previous version)
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
sys/vm/vm_fault.c