summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_contig.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2003-10-18 21:09:21 +0000
committeralc <alc@FreeBSD.org>2003-10-18 21:09:21 +0000
commitbccf1d15ab7d014c463b46b05e0b09fb513d7068 (patch)
tree6b34fce36d3e8914acee117ce4e8c611179e0683 /sys/vm/vm_contig.c
parent39bde695bfe32db71446c96d796c9d24d4abbf2c (diff)
downloadFreeBSD-src-bccf1d15ab7d014c463b46b05e0b09fb513d7068.zip
FreeBSD-src-bccf1d15ab7d014c463b46b05e0b09fb513d7068.tar.gz
- Increase the object lock's scope in vm_contig_launder() so that access
to the object's type field and the call to vm_pageout_flush() are synchronized. - The above change allows for the eliminaton of the last parameter to vm_pageout_flush(). - Synchronize access to the page's valid field in vm_pageout_flush() using the containing object's lock.
Diffstat (limited to 'sys/vm/vm_contig.c')
-rw-r--r--sys/vm/vm_contig.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/vm/vm_contig.c b/sys/vm/vm_contig.c
index 9e6f57d..ebfce02 100644
--- a/sys/vm/vm_contig.c
+++ b/sys/vm/vm_contig.c
@@ -91,12 +91,16 @@ vm_contig_launder(int queue)
{
vm_object_t object;
vm_page_t m, m_tmp, next;
+ struct vnode *vp;
for (m = TAILQ_FIRST(&vm_page_queues[queue].pl); m != NULL; m = next) {
next = TAILQ_NEXT(m, pageq);
KASSERT(m->queue == queue,
("vm_contig_launder: page %p's queue is not %d", m, queue));
+ if (!VM_OBJECT_TRYLOCK(m->object))
+ continue;
if (vm_page_sleep_if_busy(m, TRUE, "vpctw0")) {
+ VM_OBJECT_UNLOCK(m->object);
vm_page_lock_queues();
return (TRUE);
}
@@ -105,22 +109,25 @@ vm_contig_launder(int queue)
object = m->object;
if (object->type == OBJT_VNODE) {
vm_page_unlock_queues();
- vn_lock(object->handle,
- LK_EXCLUSIVE | LK_RETRY, curthread);
+ vp = object->handle;
+ VM_OBJECT_UNLOCK(object);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread);
VM_OBJECT_LOCK(object);
vm_object_page_clean(object, 0, 0, OBJPC_SYNC);
VM_OBJECT_UNLOCK(object);
- VOP_UNLOCK(object->handle, 0, curthread);
+ VOP_UNLOCK(vp, 0, curthread);
vm_page_lock_queues();
return (TRUE);
} else if (object->type == OBJT_SWAP ||
object->type == OBJT_DEFAULT) {
m_tmp = m;
- vm_pageout_flush(&m_tmp, 1, 0, FALSE);
+ vm_pageout_flush(&m_tmp, 1, 0);
+ VM_OBJECT_UNLOCK(object);
return (TRUE);
}
} else if (m->busy == 0 && m->hold_count == 0)
vm_page_cache(m);
+ VM_OBJECT_UNLOCK(m->object);
}
return (FALSE);
}
OpenPOWER on IntegriCloud