diff options
author | alc <alc@FreeBSD.org> | 2004-10-24 19:32:19 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2004-10-24 19:32:19 +0000 |
commit | 0041f5bef40a72af5bca742616209ccb2ef3761b (patch) | |
tree | b296d5ee80fe0fd8f96232e43fbab46660d42c5c /sys/vm/vm_contig.c | |
parent | 17eb61eeb6cad08f2c8534523d46fdfa1a386bd9 (diff) | |
download | FreeBSD-src-0041f5bef40a72af5bca742616209ccb2ef3761b.zip FreeBSD-src-0041f5bef40a72af5bca742616209ccb2ef3761b.tar.gz |
Acquire the vm object lock before rather than after calling
vm_page_sleep_if_busy(). (The motivation being to transition
synchronization of the vm_page's PG_BUSY flag from the global page queues
lock to the per-object lock.)
Diffstat (limited to 'sys/vm/vm_contig.c')
-rw-r--r-- | sys/vm/vm_contig.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/vm/vm_contig.c b/sys/vm/vm_contig.c index 40b79e3..5ebf1bc 100644 --- a/sys/vm/vm_contig.c +++ b/sys/vm/vm_contig.c @@ -92,17 +92,18 @@ vm_contig_launder_page(vm_page_t m) vm_page_t m_tmp; struct vnode *vp; + object = m->object; + if (!VM_OBJECT_TRYLOCK(object)) + return (EAGAIN); if (vm_page_sleep_if_busy(m, TRUE, "vpctw0")) { + VM_OBJECT_UNLOCK(object); vm_page_lock_queues(); return (EBUSY); } - if (!VM_OBJECT_TRYLOCK(m->object)) - return (EAGAIN); vm_page_test_dirty(m); if (m->dirty == 0 && m->hold_count == 0) pmap_remove_all(m); if (m->dirty) { - object = m->object; if (object->type == OBJT_VNODE) { vm_page_unlock_queues(); vp = object->handle; @@ -123,7 +124,7 @@ vm_contig_launder_page(vm_page_t m) } } else if (m->hold_count == 0) vm_page_cache(m); - VM_OBJECT_UNLOCK(m->object); + VM_OBJECT_UNLOCK(object); return (0); } |