summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2011-01-30 23:55:48 +0000
committeralc <alc@FreeBSD.org>2011-01-30 23:55:48 +0000
commita8872fa39a27f509988f87bcab8aa694a0c8e3d6 (patch)
treed26d51fb82fe96845bfd0434f3a345c9eec41248
parent8605caacbf4653c0daaaf53f746ae27fc93c1ef3 (diff)
downloadFreeBSD-src-a8872fa39a27f509988f87bcab8aa694a0c8e3d6.zip
FreeBSD-src-a8872fa39a27f509988f87bcab8aa694a0c8e3d6.tar.gz
Release the free page queues lock earlier in vm_page_alloc().
Discussed with: kib@
-rw-r--r--sys/vm/vm_page.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 562483d..b9d2c90 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -1318,7 +1318,8 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req)
}
/*
- * 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_pindex_t pindex, int req)
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) {
OpenPOWER on IntegriCloud