Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Apr 2010 16:18:45 +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: r207374 - head/sys/vm
Message-ID:  <201004291618.o3TGIjjo094707@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Thu Apr 29 16:18:45 2010
New Revision: 207374
URL: http://svn.freebsd.org/changeset/base/207374

Log:
  Simplify the inner loop of vm_pageout_object_deactivate_pages().  Rather
  than checking each page for PG_UNMANAGED, check the vm object's type.
  Only OBJT_PHYS can have unmanaged pages.  Eliminate a pointless counter.
  The vm object is locked, that lock is never released by the inner loop,
  and the set of pages contained by the vm object is not changed by the
  inner loop.  Therefore, the counter serves no purpose.

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==============================================================================
--- head/sys/vm/vm_pageout.c	Thu Apr 29 15:47:31 2010	(r207373)
+++ head/sys/vm/vm_pageout.c	Thu Apr 29 16:18:45 2010	(r207374)
@@ -508,17 +508,16 @@ vm_pageout_object_deactivate_pages(pmap,
 {
 	vm_object_t backing_object, object;
 	vm_page_t p, next;
-	int actcount, rcount, remove_mode;
+	int actcount, remove_mode;
 
 	VM_OBJECT_LOCK_ASSERT(first_object, MA_OWNED);
 	if (first_object->type == OBJT_DEVICE ||
-	    first_object->type == OBJT_SG ||
-	    first_object->type == OBJT_PHYS)
+	    first_object->type == OBJT_SG)
 		return;
 	for (object = first_object;; object = backing_object) {
 		if (pmap_resident_count(pmap) <= desired)
 			goto unlock_return;
-		if (object->paging_in_progress)
+		if (object->type == OBJT_PHYS || object->paging_in_progress)
 			goto unlock_return;
 
 		remove_mode = 0;
@@ -527,10 +526,9 @@ vm_pageout_object_deactivate_pages(pmap,
 		/*
 		 * scan the objects entire memory queue
 		 */
-		rcount = object->resident_page_count;
 		p = TAILQ_FIRST(&object->memq);
 		vm_page_lock_queues();
-		while (p && (rcount-- > 0)) {
+		while (p != NULL) {
 			if (pmap_resident_count(pmap) <= desired) {
 				vm_page_unlock_queues();
 				goto unlock_return;
@@ -541,7 +539,6 @@ vm_pageout_object_deactivate_pages(pmap,
 			    p->hold_count != 0 ||
 			    p->busy != 0 ||
 			    (p->oflags & VPO_BUSY) ||
-			    (p->flags & PG_UNMANAGED) ||
 			    !pmap_page_exists_quick(pmap, p)) {
 				p = next;
 				continue;



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