Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Jan 2011 23:55:48 +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: r218113 - head/sys/vm
Message-ID:  <201101302355.p0UNtm9G090455@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Sun Jan 30 23:55:48 2011
New Revision: 218113
URL: http://svn.freebsd.org/changeset/base/218113

Log:
  Release the free page queues lock earlier in vm_page_alloc().
  
  Discussed with:	kib@

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Sun Jan 30 23:29:45 2011	(r218112)
+++ head/sys/vm/vm_page.c	Sun Jan 30 23:55:48 2011	(r218113)
@@ -1318,7 +1318,8 @@ vm_page_alloc(vm_object_t object, vm_pin
 	}
 
 	/*
-	 * Initialize structure.  Only the PG_ZERO flag is inherited.
+	 * Only the PG_ZERO flag is inherited.  The PG_CACHED or PG_FREE flag
+	 * must be cleared before the free page queues lock is released.
 	 */
 	flags = 0;
 	if (m->flags & PG_ZERO) {
@@ -1329,15 +1330,19 @@ vm_page_alloc(vm_object_t object, vm_pin
 	if (object == NULL || object->type == OBJT_PHYS)
 		flags |= PG_UNMANAGED;
 	m->flags = flags;
+	mtx_unlock(&vm_page_queue_free_mtx);
 	if (req & (VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ))
 		m->oflags = 0;
 	else
 		m->oflags = VPO_BUSY;
 	if (req & VM_ALLOC_WIRED) {
+		/*
+		 * The page lock is not required for wiring a page until that
+		 * page is inserted into the object.
+		 */
 		atomic_add_int(&cnt.v_wire_count, 1);
 		m->wire_count = 1;
 	}
-	mtx_unlock(&vm_page_queue_free_mtx);
 	m->act_count = 0;
 
 	if (object != NULL) {



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