From bccf1d15ab7d014c463b46b05e0b09fb513d7068 Mon Sep 17 00:00:00 2001 From: alc Date: Sat, 18 Oct 2003 21:09:21 +0000 Subject: - 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. --- sys/vm/vm_pageout.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'sys/vm/vm_pageout.c') diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 2fc45fe..a073613 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -348,7 +348,7 @@ more: /* * we allow reads during pageouts... */ - return (vm_pageout_flush(&mc[page_base], pageout_count, 0, TRUE)); + return (vm_pageout_flush(&mc[page_base], pageout_count, 0)); } /* @@ -361,11 +361,7 @@ more: * the ordering. */ int -vm_pageout_flush(mc, count, flags, is_object_locked) - vm_page_t *mc; - int count; - int flags; - int is_object_locked; +vm_pageout_flush(vm_page_t *mc, int count, int flags) { vm_object_t object; int pageout_status[count]; @@ -384,14 +380,14 @@ vm_pageout_flush(mc, count, flags, is_object_locked) * edge case with file fragments. */ for (i = 0; i < count; i++) { - KASSERT(mc[i]->valid == VM_PAGE_BITS_ALL, ("vm_pageout_flush page %p index %d/%d: partially invalid page", mc[i], i, count)); + KASSERT(mc[i]->valid == VM_PAGE_BITS_ALL, + ("vm_pageout_flush: partially invalid page %p index %d/%d", + mc[i], i, count)); vm_page_io_start(mc[i]); pmap_page_protect(mc[i], VM_PROT_READ); } object = mc[0]->object; vm_page_unlock_queues(); - if (!is_object_locked) - VM_OBJECT_LOCK(object); vm_object_pip_add(object, count); VM_OBJECT_UNLOCK(object); @@ -444,8 +440,6 @@ vm_pageout_flush(mc, count, flags, is_object_locked) pmap_page_protect(mt, VM_PROT_READ); } } - if (!is_object_locked) - VM_OBJECT_UNLOCK(object); return numpagedout; } -- cgit v1.1