Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jun 2010 17:20:33 +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: r209610 - head/sys/vm
Message-ID:  <201006301720.o5UHKXlm010506@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Wed Jun 30 17:20:33 2010
New Revision: 209610
URL: http://svn.freebsd.org/changeset/base/209610

Log:
  Simplify entry to vm_pageout_clean().  Expect the page to be locked.
  Previously, the caller unlocked the page, and vm_pageout_clean()
  immediately reacquired the page lock.  Also, assert rather than test
  that the page is neither busy nor held.  Since vm_pageout_clean() is
  called with the object and page locked, the page can't have changed
  state since the caller verified that the page is neither busy nor
  held.

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==============================================================================
--- head/sys/vm/vm_pageout.c	Wed Jun 30 16:28:28 2010	(r209609)
+++ head/sys/vm/vm_pageout.c	Wed Jun 30 17:20:33 2010	(r209610)
@@ -325,8 +325,7 @@ vm_pageout_clean(vm_page_t m)
 	int ib, is, page_base;
 	vm_pindex_t pindex = m->pindex;
 
-	vm_page_lock_assert(m, MA_NOTOWNED);
-	vm_page_lock(m);
+	vm_page_lock_assert(m, MA_OWNED);
 	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
 
 	/*
@@ -341,11 +340,9 @@ vm_pageout_clean(vm_page_t m)
 	/*
 	 * Can't clean the page if it's busy or held.
 	 */
-	if ((m->hold_count != 0) ||
-	    ((m->busy != 0) || (m->oflags & VPO_BUSY))) {
-		vm_page_unlock(m);
-		return 0;
-	}
+	KASSERT(m->busy == 0 && (m->oflags & VPO_BUSY) == 0,
+	    ("vm_pageout_clean: page %p is busy", m));
+	KASSERT(m->hold_count == 0, ("vm_pageout_clean: page %p is held", m));
 
 	mc[vm_pageout_page_count] = pb = ps = m;
 	pageout_count = 1;
@@ -1060,7 +1057,6 @@ rescan0:
 					goto unlock_and_continue;
 				}
 			}
-			vm_page_unlock(m);
 
 			/*
 			 * If a page is dirty, then it is either being washed



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