Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Sep 2014 18:54:23 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272036 - head/sys/vm
Message-ID:  <201409231854.s8NIsNLA051940@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409231854.s8NIsNLA051940>