vm_map_pmap_enter() and pmap_enter_object() are currently not aware of

the wired attribute of the mapping.  As result, some pmap
implementations clear the wired state of the page table entries, which
breaks invariants and allows the entries to be lost.  Avoid calling
vm_map_pmap_enter() for the MADV_WILLNEED on the wired entry, the
pages must be already mapped.

Noted and reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
This commit is contained in:
Konstantin Belousov 2014-09-23 18:54:23 +00:00
parent 8302963dc2
commit 54432196db

View File

@ -2197,7 +2197,14 @@ vm_map_madvise(
vm_object_madvise(current->object.vm_object, pstart,
pend, behav);
if (behav == MADV_WILLNEED) {
/*
* Pre-populate paging structures in the
* WILLNEED case. For wired entries, the
* paging structures are already populated.
*/
if (behav == MADV_WILLNEED &&
current->wired_count == 0) {
vm_map_pmap_enter(map,
useStart,
current->protection,