Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 May 2018 04:38:10 +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: r334274 - head/sys/vm
Message-ID:  <201805280438.w4S4cAvc036390@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Mon May 28 04:38:10 2018
New Revision: 334274
URL: https://svnweb.freebsd.org/changeset/base/334274

Log:
  Eliminate duplicate assertions.  We assert at the start of vm_fault_hold()
  that the map entry is wired if the caller passes the flag VM_FAULT_WIRE.
  Eliminate the same assertion, but spelled differently, at the end of
  vm_fault_hold() and vm_fault_populate().  Repeat the assertion only if the
  map is unlocked and the map lookup must be repeated.
  
  Reviewed by:	kib
  MFC after:	10 days
  Differential Revision:	https://reviews.freebsd.org/D15582

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Mon May 28 03:14:36 2018	(r334273)
+++ head/sys/vm/vm_fault.c	Mon May 28 04:38:10 2018	(r334274)
@@ -482,10 +482,9 @@ vm_fault_populate(struct faultstate *fs, vm_prot_t pro
 		m_mtx = NULL;
 		for (i = 0; i < npages; i++) {
 			vm_page_change_lock(&m[i], &m_mtx);
-			if ((fault_flags & VM_FAULT_WIRE) != 0) {
-				KASSERT(wired, ("VM_FAULT_WIRE && !wired"));
+			if ((fault_flags & VM_FAULT_WIRE) != 0)
 				vm_page_wire(&m[i]);
-			} else
+			else
 				vm_page_activate(&m[i]);
 			if (m_hold != NULL && m[i].pindex == fs->first_pindex) {
 				*m_hold = &m[i];
@@ -1247,6 +1246,10 @@ readrest:
 				unlock_and_deallocate(&fs);
 				goto RetryFault;
 			}
+
+			/* Reassert because wired may have changed. */
+			KASSERT(wired || (fault_flags & VM_FAULT_WIRE) == 0,
+			    ("!wired && VM_FAULT_WIRE"));
 		}
 	}
 
@@ -1290,10 +1293,9 @@ readrest:
 	 * If the page is not wired down, then put it where the pageout daemon
 	 * can find it.
 	 */
-	if ((fault_flags & VM_FAULT_WIRE) != 0) {
-		KASSERT(wired, ("VM_FAULT_WIRE && !wired"));
+	if ((fault_flags & VM_FAULT_WIRE) != 0)
 		vm_page_wire(fs.m);
-	} else
+	else
 		vm_page_activate(fs.m);
 	if (m_hold != NULL) {
 		*m_hold = fs.m;



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