diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 37ff14231ba6..058107e0bbb8 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -319,12 +319,13 @@ RetryFault:; /* * check for page-based copy on write */ - + vm_page_lock_queues(); if ((fs.m->cow) && (fault_type & VM_PROT_WRITE)) { s = splvm(); vm_page_cowfault(fs.m); splx(s); + vm_page_unlock_queues(); unlock_things(&fs); goto RetryFault; } @@ -345,7 +346,6 @@ RetryFault:; * around with a vm_page_t->busy page except, perhaps, * to pmap it. */ - vm_page_lock_queues(); if ((fs.m->flags & PG_BUSY) || fs.m->busy) { vm_page_unlock_queues(); unlock_things(&fs); diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 74b520c4c5d9..f8730c1182fd 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1815,10 +1815,16 @@ vm_page_cowfault(vm_page_t m) retry_alloc: vm_page_remove(m); - mnew = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL); + /* + * An interrupt allocation is requested because the page + * queues lock is held. + */ + mnew = vm_page_alloc(object, pindex, VM_ALLOC_INTERRUPT); if (mnew == NULL) { vm_page_insert(m, object, pindex); + vm_page_unlock_queues(); VM_WAIT; + vm_page_lock_queues(); goto retry_alloc; }