Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Oct 2017 17:14:53 +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: r324960 - head/sys/vm
Message-ID:  <201710241714.v9OHErqo061325@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Tue Oct 24 17:14:53 2017
New Revision: 324960
URL: https://svnweb.freebsd.org/changeset/base/324960

Log:
  Micro-optimize the handling of fictitious pages in vm_page_free_prep().
  A fictitious page is always wired, so there is no point in trying to
  remove one from the page queues.
  
  Completely remove one inaccurate comment from vm_page_free_prep() and
  correct another.
  
  Reviewed by:	kib, markj
  MFC after:	1 week

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Tue Oct 24 16:28:00 2017	(r324959)
+++ head/sys/vm/vm_page.c	Tue Oct 24 17:14:53 2017	(r324960)
@@ -2802,27 +2802,26 @@ vm_page_free_prep(vm_page_t m, bool pagequeue_locked)
 	if (vm_page_sbusied(m))
 		panic("vm_page_free: freeing busy page %p", m);
 
+	vm_page_remove(m);
+
 	/*
-	 * Unqueue, then remove page.  Note that we cannot destroy
-	 * the page here because we do not want to call the pager's
-	 * callback routine until after we've put the page on the
-	 * appropriate free queue.
+	 * If fictitious remove object association and
+	 * return.
 	 */
+	if ((m->flags & PG_FICTITIOUS) != 0) {
+		KASSERT(m->wire_count == 1,
+		    ("fictitious page %p is not wired", m));
+		KASSERT(m->queue == PQ_NONE,
+		    ("fictitious page %p is queued", m));
+		return (false);
+	}
+
 	if (m->queue != PQ_NONE) {
 		if (pagequeue_locked)
 			vm_page_dequeue_locked(m);
 		else
 			vm_page_dequeue(m);
 	}
-	vm_page_remove(m);
-
-	/*
-	 * If fictitious remove object association and
-	 * return, otherwise delay object association removal.
-	 */
-	if ((m->flags & PG_FICTITIOUS) != 0)
-		return (false);
-
 	m->valid = 0;
 	vm_page_undirty(m);
 



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