Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Sep 2017 17:55:41 +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: r324087 - head/sys/vm
Message-ID:  <201709281755.v8SHtfL4075736@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Thu Sep 28 17:55:41 2017
New Revision: 324087
URL: https://svnweb.freebsd.org/changeset/base/324087

Log:
  Optimize vm_object_page_remove() by eliminating pointless calls to
  pmap_remove_all().  If the object to which a page belongs has no
  references, then that page cannot possibly be mapped.
  
  Reviewed by:	kib
  MFC after:	1 week

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c	Thu Sep 28 15:58:41 2017	(r324086)
+++ head/sys/vm/vm_object.c	Thu Sep 28 17:55:41 2017	(r324087)
@@ -1990,7 +1990,8 @@ again:
 			goto again;
 		}
 		if (p->wire_count != 0) {
-			if ((options & OBJPR_NOTMAPPED) == 0)
+			if ((options & OBJPR_NOTMAPPED) == 0 &&
+			    object->ref_count != 0)
 				pmap_remove_all(p);
 			if ((options & OBJPR_CLEANONLY) == 0) {
 				p->valid = 0;
@@ -2007,12 +2008,13 @@ again:
 		KASSERT((p->flags & PG_FICTITIOUS) == 0,
 		    ("vm_object_page_remove: page %p is fictitious", p));
 		if ((options & OBJPR_CLEANONLY) != 0 && p->valid != 0) {
-			if ((options & OBJPR_NOTMAPPED) == 0)
+			if ((options & OBJPR_NOTMAPPED) == 0 &&
+			    object->ref_count != 0)
 				pmap_remove_write(p);
-			if (p->dirty)
+			if (p->dirty != 0)
 				continue;
 		}
-		if ((options & OBJPR_NOTMAPPED) == 0)
+		if ((options & OBJPR_NOTMAPPED) == 0 && object->ref_count != 0)
 			pmap_remove_all(p);
 		p->flags &= ~PG_ZERO;
 		if (vm_page_free_prep(p, false))



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