svn commit: r272036 - head/sys/vm

Konstantin Belousov kib at FreeBSD.org
Tue Sep 23 18:54:24 UTC 2014


Author: kib
Date: Tue Sep 23 18:54:23 2014
New Revision: 272036
URL: http://svnweb.freebsd.org/changeset/base/272036

Log:
  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

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c	Tue Sep 23 18:38:06 2014	(r272035)
+++ head/sys/vm/vm_map.c	Tue Sep 23 18:54:23 2014	(r272036)
@@ -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,


More information about the svn-src-all mailing list