Lines Matching defs:npages
515 u_long npages;
527 npages = 0;
544 npages > VM_DMA32_NPAGES_THRESHOLD &&
552 npages += atop(seg->end - seg->start);
573 npages = 0;
578 seg->first_page = &vm_page_array[npages];
579 npages += atop(seg->end - seg->start);
718 int npages;
720 npages = 1 << order;
721 m_next = m + npages;
722 pa = m->phys_addr + ptoa(npages);
732 * Add the physical pages [m, m + npages) at the beginning of a power-of-two
744 vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool,
749 KASSERT(npages == 0 ||
751 ((PAGE_SIZE << ilog2(npages)) - 1)) == 0,
752 ("%s: page %p and npages %u are misaligned",
753 __func__, m, npages));
754 while (npages > 0) {
758 order = ilog2(npages);
763 npages -= 1 << order;
768 * Add the physical pages [m, m + npages) at the end of a power-of-two aligned
777 * If npages is zero, this function does nothing and ignores the physical page
781 vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool,
786 KASSERT(npages == 0 ||
787 ((VM_PAGE_TO_PHYS(m) + npages * PAGE_SIZE) &
788 ((PAGE_SIZE << ilog2(npages)) - 1)) == 0,
789 ("vm_phys_enq_range: page %p and npages %u are misaligned",
790 m, npages));
791 while (npages > 0) {
795 order = ffs(npages) - 1;
798 npages -= 1 << order;
844 vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[])
854 KASSERT(npages <= 1 << (VM_NFREEORDER - 1),
855 ("vm_phys_alloc_npages: npages %d is out of range", npages));
867 end = imin(npages, avail);
870 if (i == npages) {
877 return (npages);
890 end = imin(npages, avail);
893 if (i == npages) {
901 return (npages);
1356 vm_phys_enqueue_contig(vm_page_t m, int pool, u_long npages)
1371 m_end = m + npages;
1375 (diff = lo ^ (lo + npages - 1)) != 0) {
1386 __func__, m_end - npages, m));
1402 vm_phys_free_contig(vm_page_t m, int pool, u_long npages)
1411 max_order = min(ilog2(lo ^ (lo + npages)), VM_NFREEORDER - 1);
1417 m_end = m + npages;
1418 order_end = ffsll(lo + npages) - 1;
1440 u_long npages, vm_paddr_t low, vm_paddr_t high)
1445 KASSERT(npages > 0, ("npages is zero"));
1455 if (pa_end - pa_start < ptoa(npages))
1550 vm_phys_find_freelist_contig(struct vm_freelist *fl, u_long npages,
1559 size = npages << PAGE_SHIFT;
1608 m_iter < m_ret + npages && max_order == m_iter->order;
1611 if (m_iter < m_ret + npages)
1625 u_long npages, vm_paddr_t low, vm_paddr_t high,
1633 KASSERT(npages > 0, ("npages is 0"));
1636 /* Compute the queue that is the best fit for npages. */
1637 order = flsl(npages - 1);
1639 size = npages << PAGE_SHIFT;
1663 m_ret = vm_phys_find_freelist_contig(fl, npages,
1673 * "npages" from the free lists. All of the physical pages must be at
1683 vm_phys_alloc_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high,
1693 KASSERT(npages > 0, ("npages is 0"));
1715 if (pa_end - pa_start < ptoa(npages))
1726 m_run = vm_phys_find_queues_contig(queues, npages,
1735 for (m = m_run; m < &m_run[npages]; m = &m[1 << oind]) {
1743 vm_phys_enq_range(&m_run[npages], m - &m_run[npages], fl,
1750 KASSERT(pa_start + ptoa(npages) <= high,
1755 KASSERT(vm_addr_ok(pa_start, ptoa(npages), alignment, boundary),