Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 May 2010 04:14:07 +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: r207738 - head/sys/vm
Message-ID:  <201005070414.o474E7tR084390@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Fri May  7 04:14:07 2010
New Revision: 207738
URL: http://svn.freebsd.org/changeset/base/207738

Log:
  Push down the page queues lock into vm_page_deactivate().  Eliminate an
  incorrect comment.

Modified:
  head/sys/vm/vm_fault.c
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Fri May  7 04:04:24 2010	(r207737)
+++ head/sys/vm/vm_fault.c	Fri May  7 04:14:07 2010	(r207738)
@@ -138,9 +138,7 @@ release_page(struct faultstate *fs)
 
 	vm_page_wakeup(fs->m);
 	vm_page_lock(fs->m);
-	vm_page_lock_queues();
 	vm_page_deactivate(fs->m);
-	vm_page_unlock_queues();
 	vm_page_unlock(fs->m);
 	fs->m = NULL;
 }

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Fri May  7 04:04:24 2010	(r207737)
+++ head/sys/vm/vm_page.c	Fri May  7 04:14:07 2010	(r207738)
@@ -1618,10 +1618,8 @@ vm_page_unwire(vm_page_t m, int activate
 	}
 }
 
-
 /*
- * Move the specified page to the inactive queue.  If the page has
- * any associated swap, the swap is deallocated.
+ * Move the specified page to the inactive queue.
  *
  * Normally athead is 0 resulting in LRU operation.  athead is set
  * to 1 if we want this page to be 'as if it were placed in the cache',
@@ -1633,7 +1631,6 @@ static inline void
 _vm_page_deactivate(vm_page_t m, int athead)
 {
 
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	vm_page_lock_assert(m, MA_OWNED);
 
 	/*
@@ -1642,6 +1639,7 @@ _vm_page_deactivate(vm_page_t m, int ath
 	if (VM_PAGE_INQUEUE2(m, PQ_INACTIVE))
 		return;
 	if (m->wire_count == 0 && (m->flags & PG_UNMANAGED) == 0) {
+		vm_page_lock_queues();
 		vm_page_flag_clear(m, PG_WINATCFLS);
 		vm_pageq_remove(m);
 		if (athead)
@@ -1650,13 +1648,20 @@ _vm_page_deactivate(vm_page_t m, int ath
 			TAILQ_INSERT_TAIL(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
 		VM_PAGE_SETQUEUE2(m, PQ_INACTIVE);
 		cnt.v_inactive_count++;
+		vm_page_unlock_queues();
 	}
 }
 
+/*
+ * Move the specified page to the inactive queue.
+ *
+ * The page must be locked.
+ */
 void
 vm_page_deactivate(vm_page_t m)
 {
-    _vm_page_deactivate(m, 0);
+
+	_vm_page_deactivate(m, 0);
 }
 
 /*



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