diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index df686f3e46dc..6e0415b30600 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -485,7 +485,9 @@ vm_fault_populate_cleanup(vm_object_t object, vm_pindex_t first, VM_OBJECT_ASSERT_WLOCKED(object); MPASS(first <= last); for (pidx = first, m = vm_page_lookup(object, pidx); - pidx <= last; pidx++, m = vm_page_next(m)) { + pidx <= last; pidx++, m = TAILQ_NEXT(m, listq)) { + KASSERT(m != NULL && m->pindex == pidx, + ("%s: pindex mismatch", __func__)); vm_fault_populate_check_page(m); vm_page_deactivate(m); vm_page_xunbusy(m); @@ -623,9 +625,10 @@ vm_fault_populate(struct faultstate *fs) } for (pidx = pager_first, m = vm_page_lookup(fs->first_object, pidx); pidx <= pager_last; - pidx += npages, m = vm_page_next(&m[npages - 1])) { + pidx += npages, m = TAILQ_NEXT(&m[npages - 1], listq)) { vaddr = fs->entry->start + IDX_TO_OFF(pidx) - fs->entry->offset; - + KASSERT(m != NULL && m->pindex == pidx, + ("%s: pindex mismatch", __func__)); psind = m->psind; while (psind > 0 && ((vaddr & (pagesizes[psind] - 1)) != 0 || pidx + OFF_TO_IDX(pagesizes[psind]) - 1 > pager_last ||