Index: sys/arm/nvidia/drm2/tegra_bo.c =================================================================== --- sys/arm/nvidia/drm2/tegra_bo.c +++ sys/arm/nvidia/drm2/tegra_bo.c @@ -64,7 +64,8 @@ for (i = 0; i < bo->npages; i++) { m = vm_page_iter_lookup(&pages, i); vm_page_busy_acquire(m, 0); - cdev_mgtdev_pager_free_page(&pages, m); + vm_radix_iter_remove(&pages); + cdev_mgtdev_pager_free_page(m); m->flags &= ~PG_FICTITIOUS; vm_page_unwire_noq(m); vm_page_free(m); Index: sys/vm/device_pager.c =================================================================== --- sys/vm/device_pager.c +++ sys/vm/device_pager.c @@ -268,7 +268,8 @@ vm_page_iter_init(&pages, object); vm_page_iter_lookup(&pages, m->pindex); - cdev_mgtdev_pager_free_page(&pages, m); + vm_radix_iter_remove(&pages); + cdev_mgtdev_pager_free_page(m); } else if (object->type == OBJT_DEVICE) dev_pager_free_page(object, m); else @@ -277,10 +278,10 @@ } void -cdev_mgtdev_pager_free_page(struct pctrie_iter *pages, vm_page_t m) +cdev_mgtdev_pager_free_page(vm_page_t m) { pmap_remove_all(m); - vm_page_iter_remove(pages, m); + vm_page_iter_remove(m); } void @@ -298,7 +299,8 @@ pctrie_iter_reset(&pages); goto retry; } - cdev_mgtdev_pager_free_page(&pages, m); + vm_radix_iter_remove(&pages); + cdev_mgtdev_pager_free_page(m); } VM_OBJECT_WUNLOCK(object); } Index: sys/vm/vm_kern.c =================================================================== --- sys/vm/vm_kern.c +++ sys/vm/vm_kern.c @@ -660,7 +660,8 @@ m = vm_page_iter_lookup(&pages, atop(offset))) { vm_page_xbusy_claim(m); vm_page_unwire_noq(m); - vm_page_iter_free(&pages, m); + vm_radix_iter_remove(&pages); + vm_page_iter_free(m); } VM_OBJECT_WUNLOCK(object); Index: sys/vm/vm_object.c =================================================================== --- sys/vm/vm_object.c +++ sys/vm/vm_object.c @@ -1599,7 +1599,8 @@ * an incomplete fault. Just remove and ignore. */ if (vm_page_none_valid(m)) { - if (vm_page_iter_remove(&pages, m)) + vm_radix_iter_remove(&pages); + if (vm_page_iter_remove(m)) vm_page_free(m); continue; } @@ -1727,7 +1728,8 @@ KASSERT(!pmap_page_is_mapped(p), ("freeing mapped page %p", p)); - if (vm_page_iter_remove(&pages, p)) + vm_radix_iter_remove(&pages); + if (vm_page_iter_remove(p)) vm_page_free(p); next = vm_radix_iter_step(&pages); continue; @@ -1736,7 +1738,8 @@ if (!vm_page_all_valid(p)) { KASSERT(!pmap_page_is_mapped(p), ("freeing mapped page %p", p)); - if (vm_page_iter_remove(&pages, p)) + vm_radix_iter_remove(&pages); + if (vm_page_iter_remove(p)) vm_page_free(p); next = vm_radix_iter_step(&pages); continue; @@ -1779,7 +1782,8 @@ ("freeing mapped page %p", p)); if (pp != NULL) vm_page_xunbusy(pp); - if (vm_page_iter_remove(&pages, p)) + vm_radix_iter_remove(&pages); + if (vm_page_iter_remove(p)) vm_page_free(p); next = vm_radix_iter_step(&pages); continue; @@ -2062,7 +2066,8 @@ if ((options & OBJPR_NOTMAPPED) == 0 && object->ref_count != 0 && !vm_page_try_remove_all(p)) goto wired; - vm_page_iter_free(&pages, p); + vm_radix_iter_remove(&pages); + vm_page_iter_free(p); } vm_object_pip_wakeup(object); Index: sys/vm/vm_page.h =================================================================== --- sys/vm/vm_page.h +++ sys/vm/vm_page.h @@ -650,11 +650,11 @@ void vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segind, int pool); int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); void vm_page_invalid(vm_page_t m); -void vm_page_iter_free(struct pctrie_iter *pages, vm_page_t m); +void vm_page_iter_free(vm_page_t m); void vm_page_iter_init(struct pctrie_iter *, vm_object_t); void vm_page_iter_limit_init(struct pctrie_iter *, vm_object_t, vm_pindex_t); vm_page_t vm_page_iter_lookup(struct pctrie_iter *, vm_pindex_t); -bool vm_page_iter_remove(struct pctrie_iter *pages, vm_page_t m); +bool vm_page_iter_remove(vm_page_t m); bool vm_page_iter_rename(struct pctrie_iter *old_pages, vm_page_t m, vm_object_t new_object, vm_pindex_t new_pindex); void vm_page_launder(vm_page_t m); Index: sys/vm/vm_page.c =================================================================== --- sys/vm/vm_page.c +++ sys/vm/vm_page.c @@ -1713,13 +1713,11 @@ /* * vm_page_iter_free: * - * Free the given page, and use the iterator to remove it from the radix - * tree. + * Free the given page, which has been already removed from the radix tree. */ void -vm_page_iter_free(struct pctrie_iter *pages, vm_page_t m) +vm_page_iter_free(vm_page_t m) { - vm_radix_iter_remove(pages); vm_page_free_object_prep(m); vm_page_xunbusy(m); m->flags &= ~PG_ZERO; @@ -1752,15 +1750,14 @@ /* * vm_page_iter_remove: * - * Remove the current page, and use the iterator to remove it from the - * radix tree. + * Remove the current page, which has been already removed from the radix + * tree. */ bool -vm_page_iter_remove(struct pctrie_iter *pages, vm_page_t m) +vm_page_iter_remove(vm_page_t m) { bool dropped; - vm_radix_iter_remove(pages); vm_page_remove_radixdone(m); dropped = (vm_page_drop(m, VPRC_OBJREF) == VPRC_OBJREF); vm_page_xunbusy(m); Index: sys/vm/vm_pager.h =================================================================== --- sys/vm/vm_pager.h +++ sys/vm/vm_pager.h @@ -300,7 +300,7 @@ vm_ooffset_t foff, struct ucred *cred); vm_object_t cdev_pager_lookup(void *handle); void cdev_pager_free_page(vm_object_t object, vm_page_t m); -void cdev_mgtdev_pager_free_page(struct pctrie_iter *pages, vm_page_t m); +void cdev_mgtdev_pager_free_page(vm_page_t m); void cdev_mgtdev_pager_free_pages(vm_object_t object); struct phys_pager_ops {