Index: sys/vm/vm_phys.c =================================================================== --- sys/vm/vm_phys.c +++ sys/vm/vm_phys.c @@ -1416,6 +1416,18 @@ goto done; } while (VM_NFREEORDER - 1 == seg->first_page[ atop(pa - seg->start)].order); + + for (;;) { + m = &seg->first_page[ + atop(pa - seg->start)]; + if (m->order == VM_NFREEORDER || + pa + (2 << (PAGE_SHIFT + m->order)) + <= pa_end) + break; + pa += 1 << (PAGE_SHIFT + m->order); + if (pa >= pa_end) + goto done; + } } } } @@ -1423,6 +1435,7 @@ done: for (m = m_ret; m < &m_ret[npages]; m = &m[1 << oind]) { fl = (*queues)[m->pool]; + oind = m->order; vm_freelist_rem(fl, m, oind); if (m->pool != VM_FREEPOOL_DEFAULT) vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, oind);