diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1996,10 +1996,8 @@ } /* - * Allocate a page in the specified object with the given page index. To - * optimize insertion of the page into the object, the caller must also specify - * the resident page in the object with largest index smaller than the given - * page index, or NULL if no such page exists. + * Allocate a page in the specified object with the given page index. If the + * object lock is dropped and regained, the pages iter is reset. */ vm_page_t vm_page_alloc_iter(vm_object_t object, vm_pindex_t pindex, int req, @@ -5189,6 +5187,7 @@ break; m = vm_page_alloc_iter(object, pindex + i, pflags | VM_ALLOC_COUNT(count - i), &pages); + /* pages was reset if alloc_iter lost the lock. */ if (m == NULL) { if ((allocflags & (VM_ALLOC_NOWAIT | VM_ALLOC_WAITFAIL)) != 0)