Index: sys/vm/vm_page.c =================================================================== --- sys/vm/vm_page.c +++ sys/vm/vm_page.c @@ -427,11 +427,9 @@ * lists. */ static void -vm_page_init_page(vm_paddr_t pa) +vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segind) { - vm_page_t m; - m = vm_phys_paddr_to_vm_page(pa); m->object = NULL; m->wire_count = 0; m->busy_lock = VPB_UNBUSIED; @@ -440,7 +438,7 @@ m->phys_addr = pa; m->queue = PQ_NONE; m->psind = 0; - m->segind = vm_phys_paddr_to_segind(pa); + m->segind = segind; m->order = VM_NFREEORDER; m->pool = VM_FREEPOOL_DEFAULT; m->valid = m->dirty = 0; @@ -694,8 +692,9 @@ vm_cnt.v_free_count = 0; for (segind = 0; segind < vm_phys_nsegs; segind++) { seg = &vm_phys_segs[segind]; - for (pa = seg->start; pa < seg->end; pa += PAGE_SIZE) - vm_page_init_page(pa); + for (m = seg->first_page, pa = seg->start; pa < seg->end; + m++, pa += PAGE_SIZE) + vm_page_init_page(m, pa, segind); /* * Add the segment to the free lists only if it is covered by Index: sys/vm/vm_phys.h =================================================================== --- sys/vm/vm_phys.h +++ sys/vm/vm_phys.h @@ -82,7 +82,6 @@ void vm_phys_free_contig(vm_page_t m, u_long npages); void vm_phys_free_pages(vm_page_t m, int order); void vm_phys_init(void); -int vm_phys_paddr_to_segind(vm_paddr_t pa); vm_page_t vm_phys_paddr_to_vm_page(vm_paddr_t pa); vm_page_t vm_phys_scan_contig(u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, int options); Index: sys/vm/vm_phys.c =================================================================== --- sys/vm/vm_phys.c +++ sys/vm/vm_phys.c @@ -1035,24 +1035,6 @@ free(seg, M_FICT_PAGES); } -/* - * Find the segment containing the given physical address. - */ -int -vm_phys_paddr_to_segind(vm_paddr_t pa) -{ - struct vm_phys_seg *seg; - int segind; - - for (segind = 0; segind < vm_phys_nsegs; segind++) { - seg = &vm_phys_segs[segind]; - if (pa >= seg->start && pa < seg->end) - return (segind); - } - panic("vm_phys_paddr_to_segind: paddr %#jx is not in any segment" , - (uintmax_t)pa); -} - /* * Free a contiguous, power of two-sized set of physical pages. *