Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Apr 2010 04:57:32 +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: r207306 - head/sys/vm
Message-ID:  <201004280457.o3S4vWCH026725@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Wed Apr 28 04:57:32 2010
New Revision: 207306
URL: http://svn.freebsd.org/changeset/base/207306

Log:
  Change vm_object_madvise() so that it checks whether the page is invalid
  or unmanaged before acquiring the page queues lock.  Neither of these
  tests require that lock.  Moreover, a better way of testing if the page
  is unmanaged is to test the type of vm object.  This avoids a pointless
  vm_page_lookup().
  
  MFC after:	3 weeks

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c	Wed Apr 28 04:25:36 2010	(r207305)
+++ head/sys/vm/vm_object.c	Wed Apr 28 04:57:32 2010	(r207306)
@@ -1162,7 +1162,8 @@ shadowlookup:
 			    (tobject->flags & OBJ_ONEMAPPING) == 0) {
 				goto unlock_tobject;
 			}
-		}
+		} else if (tobject->type == OBJT_PHYS)
+			goto unlock_tobject;
 		m = vm_page_lookup(tobject, tpindex);
 		if (m == NULL && advise == MADV_WILLNEED) {
 			/*
@@ -1189,18 +1190,13 @@ shadowlookup:
 				VM_OBJECT_UNLOCK(tobject);
 			tobject = backing_object;
 			goto shadowlookup;
-		}
+		} else if (m->valid != VM_PAGE_BITS_ALL)
+			goto unlock_tobject;
 		/*
-		 * If the page is busy or not in a normal active state,
-		 * we skip it.  If the page is not managed there are no
-		 * page queues to mess with.  Things can break if we mess
-		 * with pages in any of the below states.
+		 * If the page is not in a normal state, skip it.
 		 */
 		vm_page_lock_queues();
-		if (m->hold_count ||
-		    m->wire_count ||
-		    (m->flags & PG_UNMANAGED) ||
-		    m->valid != VM_PAGE_BITS_ALL) {
+		if (m->hold_count != 0 || m->wire_count != 0) {
 			vm_page_unlock_queues();
 			goto unlock_tobject;
 		}



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