svn commit: r191209 - in releng/7.2/sys: . contrib/pf dev/ath/ath_hal dev/cxgb vm

Alan Cox alc at FreeBSD.org
Fri Apr 17 16:42:04 UTC 2009


Author: alc
Date: Fri Apr 17 16:42:03 2009
New Revision: 191209
URL: http://svn.freebsd.org/changeset/base/191209

Log:
  MFC r175055
    Defer setting either PG_CACHED or PG_FREE until after the free page
    queues lock is acquired.  Otherwise, the state of a reservation's
    pages' flags and its population count can be inconsistent.  That could
    result in a page being freed twice.
  
  (This change should have been included in the MFC of the superpages
  support.)
  
  Thanks to:	pho for an illuminating crash
  
  Approved by:	re (kib)

Modified:
  releng/7.2/sys/   (props changed)
  releng/7.2/sys/contrib/pf/   (props changed)
  releng/7.2/sys/dev/ath/ath_hal/   (props changed)
  releng/7.2/sys/dev/cxgb/   (props changed)
  releng/7.2/sys/vm/vm_page.c

Modified: releng/7.2/sys/vm/vm_page.c
==============================================================================
--- releng/7.2/sys/vm/vm_page.c	Fri Apr 17 16:15:56 2009	(r191208)
+++ releng/7.2/sys/vm/vm_page.c	Fri Apr 17 16:42:03 2009	(r191209)
@@ -1402,8 +1402,8 @@ vm_page_free_toq(vm_page_t m)
 		m->flags &= ~PG_ZERO;
 		vm_page_enqueue(PQ_HOLD, m);
 	} else {
-		m->flags |= PG_FREE;
 		mtx_lock(&vm_page_queue_free_mtx);
+		m->flags |= PG_FREE;
 		cnt.v_free_count++;
 #if VM_NRESERVLEVEL > 0
 		if (!vm_reserv_free_page(m))
@@ -1654,9 +1654,9 @@ vm_page_cache(vm_page_t m)
 	 * Insert the page into the object's collection of cached pages
 	 * and the physical memory allocator's cache/free page queues.
 	 */
-	vm_page_flag_set(m, PG_CACHED);
 	vm_page_flag_clear(m, PG_ZERO);
 	mtx_lock(&vm_page_queue_free_mtx);
+	m->flags |= PG_CACHED;
 	cnt.v_cache_count++;
 	root = object->cache;
 	if (root == NULL) {


More information about the svn-src-all mailing list