Date: Wed, 3 Nov 2021 17:54:01 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 66cb1858f449 - stable/13 - Convert vm_page_alloc() callers to use vm_page_alloc_noobj(). Message-ID: <202111031754.1A3Hs1KZ029319@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=66cb1858f44992af73b6e1f9eeceb500bffd2534 commit 66cb1858f44992af73b6e1f9eeceb500bffd2534 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-10-20 00:23:39 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-11-03 17:39:36 +0000 Convert vm_page_alloc() callers to use vm_page_alloc_noobj(). Remove page zeroing code from consumers and stop specifying VM_ALLOC_NOOBJ. In a few places, also convert an allocation loop to simply use VM_ALLOC_WAITOK. Similarly, convert vm_page_alloc_domain() callers. Note that callers are now responsible for assigning the pindex. Reviewed by: alc, hselasky, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit a4667e09e6520dc2c4b0b988051f060fed695a91) --- sys/amd64/amd64/mp_machdep.c | 3 +- sys/amd64/amd64/pmap.c | 44 +++++++++--------------- sys/amd64/amd64/uma_machdep.c | 6 ++-- sys/arm/arm/pmap-v6.c | 20 +++++------ sys/arm64/arm64/pmap.c | 44 +++++++++--------------- sys/arm64/arm64/uma_machdep.c | 6 ++-- sys/compat/linuxkpi/common/src/linux_page.c | 2 +- sys/dev/drm2/ttm/ttm_page_alloc.c | 7 +--- sys/dev/ti/if_ti.c | 3 +- sys/dev/virtio/balloon/virtio_balloon.c | 3 +- sys/dev/xen/balloon/balloon.c | 21 ++++-------- sys/dev/xen/gntdev/gntdev.c | 11 ++---- sys/fs/nfs/nfs_commonsubs.c | 9 ++--- sys/fs/nfsclient/nfs_clrpcops.c | 9 ++--- sys/i386/i386/pmap.c | 44 +++++++++--------------- sys/kern/kern_mbuf.c | 4 +-- sys/kern/uipc_ktls.c | 4 +-- sys/kern/uipc_mbuf.c | 5 ++- sys/kern/vfs_bio.c | 5 ++- sys/mips/mips/pmap.c | 4 --- sys/mips/mips/uma_machdep.c | 2 -- sys/powerpc/aim/mmu_oea64.c | 7 ++-- sys/powerpc/aim/mmu_radix.c | 36 ++++++++------------ sys/powerpc/booke/pmap_32.c | 4 +-- sys/powerpc/booke/pmap_64.c | 9 ++--- sys/powerpc/powerpc/uma_machdep.c | 7 ++-- sys/riscv/riscv/pmap.c | 52 ++++++++++------------------- sys/riscv/riscv/uma_machdep.c | 6 ++-- sys/vm/uma_core.c | 22 ++++++------ sys/vm/vm_kern.c | 5 +-- sys/vm/vm_page.c | 3 +- 31 files changed, 142 insertions(+), 265 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 14853ce56603..264cc5b3bef1 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -305,8 +305,7 @@ mp_realloc_pcpu(int cpuid, int domain) oa = (vm_offset_t)&__pcpu[cpuid]; if (vm_phys_domain(pmap_kextract(oa)) == domain) return; - m = vm_page_alloc_domain(NULL, 0, domain, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ); + m = vm_page_alloc_noobj_domain(domain, 0); if (m == NULL) return; na = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index d2a168ca7f70..c9de6a875cb7 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2308,10 +2308,9 @@ pmap_init_pv_table(void) highest = start + (s / sizeof(*pvd)) - 1; for (j = 0; j < s; j += PAGE_SIZE) { - vm_page_t m = vm_page_alloc_domain(NULL, 0, - domain, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ); + vm_page_t m = vm_page_alloc_noobj_domain(domain, 0); if (m == NULL) - panic("vm_page_alloc_domain failed for %lx\n", (vm_offset_t)pvd + j); + panic("failed to allocate PV table page"); pmap_qenter((vm_offset_t)pvd + j, &m, 1); } @@ -4260,15 +4259,11 @@ pmap_alloc_pt_page(pmap_t pmap, vm_pindex_t pindex, int flags) { vm_page_t m; - m = vm_page_alloc(NULL, pindex, flags | VM_ALLOC_NOOBJ); + m = vm_page_alloc_noobj(flags); if (__predict_false(m == NULL)) return (NULL); - + m->pindex = pindex; pmap_pt_page_count_adj(pmap, 1); - - if ((flags & VM_ALLOC_ZERO) != 0 && (m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - return (m); } @@ -4306,8 +4301,8 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) /* * allocate the page directory page */ - pmltop_pg = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); + pmltop_pg = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_WIRED | VM_ALLOC_ZERO | + VM_ALLOC_WAITOK); pmltop_phys = VM_PAGE_TO_PHYS(pmltop_pg); pmap->pm_pmltop = (pml5_entry_t *)PHYS_TO_DMAP(pmltop_phys); @@ -4337,8 +4332,7 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) pmap_pinit_pml4(pmltop_pg); if ((curproc->p_md.md_flags & P_MD_KPTI) != 0) { pmltop_pgu = pmap_alloc_pt_page(NULL, 0, - VM_ALLOC_WIRED | VM_ALLOC_NORMAL | - VM_ALLOC_WAITOK); + VM_ALLOC_WIRED | VM_ALLOC_WAITOK); pmap->pm_pmltopu = (pml4_entry_t *)PHYS_TO_DMAP( VM_PAGE_TO_PHYS(pmltop_pgu)); if (pmap_is_la57(pmap)) @@ -5362,8 +5356,7 @@ retry: } } /* No free items, allocate another chunk */ - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { if (lockp == NULL) { PV_STAT(counter_u64_add(pc_chunk_tryfail, 1)); @@ -5466,8 +5459,7 @@ retry: break; } for (reclaimed = false; avail < needed; avail += _NPCPV) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { m = reclaim_pv_chunk(pmap, lockp); if (m == NULL) @@ -5839,8 +5831,7 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, * priority is normal. */ mpte = pmap_alloc_pt_page(pmap, pmap_pde_pindex(va), - (in_kernel ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | - VM_ALLOC_WIRED); + (in_kernel ? VM_ALLOC_INTERRUPT : 0) | VM_ALLOC_WIRED); /* * If the allocation of the new page table page fails, @@ -10238,8 +10229,7 @@ pmap_quick_remove_page(vm_offset_t addr) static vm_page_t pmap_large_map_getptp_unlocked(void) { - return (pmap_alloc_pt_page(kernel_pmap, 0, - VM_ALLOC_NORMAL | VM_ALLOC_ZERO)); + return (pmap_alloc_pt_page(kernel_pmap, 0, VM_ALLOC_ZERO)); } static vm_page_t @@ -11294,12 +11284,10 @@ pmap_kasan_enter_alloc_4k(void) { vm_page_t m; - m = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); + m = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | + VM_ALLOC_ZERO); if (m == NULL) panic("%s: no memory to grow shadow map", __func__); - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); return (m); } @@ -11364,12 +11352,10 @@ pmap_kmsan_enter_alloc_4k(void) { vm_page_t m; - m = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); + m = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | + VM_ALLOC_ZERO); if (m == NULL) panic("%s: no memory to grow shadow map", __func__); - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); return (m); } diff --git a/sys/amd64/amd64/uma_machdep.c b/sys/amd64/amd64/uma_machdep.c index 2fc981f23c83..479cb4e37d9e 100644 --- a/sys/amd64/amd64/uma_machdep.c +++ b/sys/amd64/amd64/uma_machdep.c @@ -49,16 +49,14 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, void *va; *flags = UMA_SLAB_PRIV; - m = vm_page_alloc_domain(NULL, 0, domain, - malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + m = vm_page_alloc_noobj_domain(domain, malloc2vm_flags(wait) | + VM_ALLOC_WIRED); if (m == NULL) return (NULL); pa = m->phys_addr; if ((wait & M_NODUMP) == 0) dump_add_page(pa); va = (void *)PHYS_TO_DMAP(pa); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - pagezero(va); return (va); } diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c index c9b939f6ce34..445f750178a8 100644 --- a/sys/arm/arm/pmap-v6.c +++ b/sys/arm/arm/pmap-v6.c @@ -2069,12 +2069,12 @@ pmap_growkernel(vm_offset_t addr) /* * Install new PT2s page into kernel PT2TAB. */ - m = vm_page_alloc(NULL, - pte1_index(kernel_vm_end) & ~PT2PG_MASK, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | + m = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (m == NULL) panic("%s: no memory to grow kernel", __func__); + m->pindex = pte1_index(kernel_vm_end) & ~PT2PG_MASK; + /* * QQQ: To link all new L2 page tables from L1 page * table now and so pmap_kenter_pte1() them @@ -2488,8 +2488,7 @@ _pmap_allocpte2(pmap_t pmap, vm_offset_t va, u_int flags) /* * Install new PT2s page into pmap PT2TAB. */ - m = vm_page_alloc(NULL, pte1_idx & ~PT2PG_MASK, - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (m == NULL) { if ((flags & PMAP_ENTER_NOSLEEP) == 0) { PMAP_UNLOCK(pmap); @@ -2505,6 +2504,7 @@ _pmap_allocpte2(pmap_t pmap, vm_offset_t va, u_int flags) */ return (NULL); } + m->pindex = pte1_idx & ~PT2PG_MASK; pmap->pm_stats.resident_count++; pt2pg_pa = pmap_pt2pg_init(pmap, va, m); } else { @@ -3062,8 +3062,8 @@ retry: * global lock. If "pv_vafree" is currently non-empty, it will * remain non-empty until pmap_pte2list_alloc() completes. */ - if (pv_vafree == 0 || (m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + if (pv_vafree == 0 || + (m = vm_page_alloc_noobj(VM_ALLOC_WIRED)) == NULL) { if (try) { pv_entry_count--; PV_STAT(pc_chunk_tryfail++); @@ -3711,9 +3711,8 @@ pmap_demote_pte1(pmap_t pmap, pt1_entry_t *pte1p, vm_offset_t va) * "failure" if the mapping was never accessed or the * allocation of the new page table page fails. */ - if ((opte1 & PTE1_A) == 0 || (m = vm_page_alloc(NULL, - pte1_index(va) & ~PT2PG_MASK, VM_ALLOC_NOOBJ | - VM_ALLOC_NORMAL | VM_ALLOC_WIRED)) == NULL) { + if ((opte1 & PTE1_A) == 0 || + (m = vm_page_alloc_noobj(VM_ALLOC_WIRED)) == NULL) { SLIST_INIT(&free); pmap_remove_pte1(pmap, pte1p, pte1_trunc(va), &free); vm_page_free_pages_toq(&free, false); @@ -3721,6 +3720,7 @@ pmap_demote_pte1(pmap_t pmap, pt1_entry_t *pte1p, vm_offset_t va) __func__, va, pmap); return (FALSE); } + m->pindex = pte1_index(va) & ~PT2PG_MASK; if (va < VM_MAXUSER_ADDRESS) pmap->pm_stats.resident_count++; diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 176762b9bfff..2bceb293f3f2 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1766,16 +1766,11 @@ pmap_pinit_stage(pmap_t pmap, enum pmap_stage stage, int levels) /* * allocate the l0 page */ - while ((m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) - vm_wait(NULL); - + m = vm_page_alloc_noobj(VM_ALLOC_WAITOK | VM_ALLOC_WIRED | + VM_ALLOC_ZERO); pmap->pm_l0_paddr = VM_PAGE_TO_PHYS(m); pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(pmap->pm_l0_paddr); - if ((m->flags & PG_ZERO) == 0) - pagezero(pmap->pm_l0); - pmap->pm_root.rt_root = 0; bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); pmap->pm_cookie = COOKIE_FROM(-1, INT_MAX); @@ -1841,8 +1836,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* * Allocate a page table page. */ - if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { + if ((m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { if (lockp != NULL) { RELEASE_PV_LIST_LOCK(lockp); PMAP_UNLOCK(pmap); @@ -1856,8 +1850,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) */ return (NULL); } - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); + m->pindex = ptepindex; /* * Because of AArch64's weak memory consistency model, we must have a @@ -2191,13 +2184,11 @@ pmap_growkernel(vm_offset_t addr) l1 = pmap_l0_to_l1(l0, kernel_vm_end); if (pmap_load(l1) == 0) { /* We need a new PDP entry */ - nkpg = vm_page_alloc(NULL, kernel_vm_end >> L1_SHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - pmap_zero_page(nkpg); + nkpg->pindex = kernel_vm_end >> L1_SHIFT; /* See the dmb() in _pmap_alloc_l3(). */ dmb(ishst); paddr = VM_PAGE_TO_PHYS(nkpg); @@ -2214,13 +2205,11 @@ pmap_growkernel(vm_offset_t addr) continue; } - nkpg = vm_page_alloc(NULL, kernel_vm_end >> L2_SHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - pmap_zero_page(nkpg); + nkpg->pindex = kernel_vm_end >> L2_SHIFT; /* See the dmb() in _pmap_alloc_l3(). */ dmb(ishst); paddr = VM_PAGE_TO_PHYS(nkpg); @@ -2565,8 +2554,7 @@ retry: } } /* No free items, allocate another chunk */ - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { if (lockp == NULL) { PV_STAT(pc_chunk_tryfail++); @@ -2631,8 +2619,7 @@ retry: break; } for (reclaimed = false; avail < needed; avail += _NPCPV) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { m = reclaim_pv_chunk(pmap, lockp); if (m == NULL) @@ -6326,8 +6313,8 @@ pmap_demote_l1(pmap_t pmap, pt_entry_t *l1, vm_offset_t va) return (NULL); } - if ((ml2 = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + if ((ml2 = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED)) == + NULL) { CTR2(KTR_PMAP, "pmap_demote_l1: failure for va %#lx" " in pmap %p", va, pmap); l2 = NULL; @@ -6460,9 +6447,9 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_offset_t va, * priority (VM_ALLOC_INTERRUPT). Otherwise, the * priority is normal. */ - ml3 = vm_page_alloc(NULL, pmap_l2_pindex(va), - (VIRT_IN_DMAP(va) ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + ml3 = vm_page_alloc_noobj( + (VIRT_IN_DMAP(va) ? VM_ALLOC_INTERRUPT : 0) | + VM_ALLOC_WIRED); /* * If the allocation of the new page table page fails, @@ -6474,6 +6461,7 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_offset_t va, " in pmap %p", va, pmap); goto fail; } + ml3->pindex = pmap_l2_pindex(va); if (!ADDR_IS_KERNEL(va)) { ml3->ref_count = NL3PG; diff --git a/sys/arm64/arm64/uma_machdep.c b/sys/arm64/arm64/uma_machdep.c index 3ef3dd3cc9e9..d1c656a3b9f1 100644 --- a/sys/arm64/arm64/uma_machdep.c +++ b/sys/arm64/arm64/uma_machdep.c @@ -47,16 +47,14 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, void *va; *flags = UMA_SLAB_PRIV; - m = vm_page_alloc_domain(NULL, 0, domain, - malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + m = vm_page_alloc_noobj_domain(domain, malloc2vm_flags(wait) | + VM_ALLOC_WIRED); if (m == NULL) return (NULL); pa = m->phys_addr; if ((wait & M_NODUMP) == 0) dump_add_page(pa); va = (void *)PHYS_TO_DMAP(pa); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - pagezero(va); return (va); } diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c index 8da4736ab7d5..f712c0c155a4 100644 --- a/sys/compat/linuxkpi/common/src/linux_page.c +++ b/sys/compat/linuxkpi/common/src/linux_page.c @@ -97,7 +97,7 @@ linux_alloc_pages(gfp_t flags, unsigned int order) if ((flags & M_ZERO) != 0) req |= VM_ALLOC_ZERO; if (order == 0 && (flags & GFP_DMA32) == 0) { - page = vm_page_alloc(NULL, 0, req); + page = vm_page_alloc_noobj(req); if (page == NULL) return (NULL); } else { diff --git a/sys/dev/drm2/ttm/ttm_page_alloc.c b/sys/dev/drm2/ttm/ttm_page_alloc.c index fbb830405de0..b35a06520e07 100644 --- a/sys/dev/drm2/ttm/ttm_page_alloc.c +++ b/sys/dev/drm2/ttm/ttm_page_alloc.c @@ -178,12 +178,7 @@ ttm_vm_page_alloc_any(int req, vm_memattr_t memattr) { vm_page_t p; - while (1) { - p = vm_page_alloc(NULL, 0, req); - if (p != NULL) - break; - vm_wait(NULL); - } + p = vm_page_alloc_noobj(req | VM_ALLOC_WAITOK); pmap_page_set_memattr(p, memattr); return (p); } diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index 9871212d6379..e8b4eb537883 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -1609,8 +1609,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int idx, struct mbuf *m_old) "failed -- packet dropped!\n"); goto nobufs; } - frame = vm_page_alloc(NULL, 0, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | + frame = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED); if (frame == NULL) { device_printf(sc->ti_dev, "buffer allocation " diff --git a/sys/dev/virtio/balloon/virtio_balloon.c b/sys/dev/virtio/balloon/virtio_balloon.c index 3e2d967dd9af..bf4e5cf916f7 100644 --- a/sys/dev/virtio/balloon/virtio_balloon.c +++ b/sys/dev/virtio/balloon/virtio_balloon.c @@ -460,8 +460,7 @@ vtballoon_alloc_page(struct vtballoon_softc *sc) { vm_page_t m; - m = vm_page_alloc(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP); + m = vm_page_alloc_noobj(VM_ALLOC_NODUMP); if (m != NULL) sc->vtballoon_current_npages++; diff --git a/sys/dev/xen/balloon/balloon.c b/sys/dev/xen/balloon/balloon.c index 01d75204f5bf..007fada24259 100644 --- a/sys/dev/xen/balloon/balloon.c +++ b/sys/dev/xen/balloon/balloon.c @@ -228,25 +228,18 @@ decrease_reservation(unsigned long nr_pages) nr_pages = nitems(frame_list); for (i = 0; i < nr_pages; i++) { - if ((page = vm_page_alloc(NULL, 0, - VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_ZERO)) == NULL) { + /* + * Zero the page, or else we might be leaking important data to + * other domains on the same host. Xen doesn't scrub ballooned + * out memory pages, the guest is in charge of making sure that + * no information is leaked. + */ + if ((page = vm_page_alloc_noobj(VM_ALLOC_ZERO)) == NULL) { nr_pages = i; need_sleep = 1; break; } - if ((page->flags & PG_ZERO) == 0) { - /* - * Zero the page, or else we might be leaking - * important data to other domains on the same - * host. Xen doesn't scrub ballooned out memory - * pages, the guest is in charge of making - * sure that no information is leaked. - */ - pmap_zero_page(page); - } - frame_list[i] = (VM_PAGE_TO_PHYS(page) >> PAGE_SHIFT); TAILQ_INSERT_HEAD(&ballooned_pages, page, plinks.q); diff --git a/sys/dev/xen/gntdev/gntdev.c b/sys/dev/xen/gntdev/gntdev.c index 8249eaba8bcc..0c89133ca1b0 100644 --- a/sys/dev/xen/gntdev/gntdev.c +++ b/sys/dev/xen/gntdev/gntdev.c @@ -368,20 +368,13 @@ gntdev_alloc_gref(struct ioctl_gntdev_alloc_gref *arg) grefs[i].file_index = file_offset + i * PAGE_SIZE; grefs[i].gref_id = GRANT_REF_INVALID; grefs[i].notify = NULL; - grefs[i].page = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL - | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO); + grefs[i].page = vm_page_alloc_noobj(VM_ALLOC_WIRED | + VM_ALLOC_ZERO); if (grefs[i].page == NULL) { log(LOG_ERR, "Page allocation failed."); error = ENOMEM; break; } - if ((grefs[i].page->flags & PG_ZERO) == 0) { - /* - * Zero the allocated page, as we don't want to - * leak our memory to other domains. - */ - pmap_zero_page(grefs[i].page); - } grefs[i].page->valid = VM_PAGE_BITS_ALL; error = gnttab_grant_foreign_access(arg->domid, diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 42b839c8567e..c8534982ee0e 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -4910,13 +4910,8 @@ nfsm_add_ext_pgs(struct mbuf *m, int maxextsiz, int *bextpg) *bextpg = 0; m->m_next = mp; } else { - do { - pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | - VM_ALLOC_WIRED); - if (pg == NULL) - vm_wait(NULL); - } while (pg == NULL); + pg = vm_page_alloc_noobj(VM_ALLOC_WAITOK | VM_ALLOC_NODUMP | + VM_ALLOC_WIRED); m->m_epg_pa[m->m_epg_npgs] = VM_PAGE_TO_PHYS(pg); *bextpg = m->m_epg_npgs; m->m_epg_npgs++; diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 211fd3523f34..30b68b1dcb1b 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -8674,13 +8674,8 @@ nfsm_split(struct mbuf *mp, uint64_t xfer) * page. */ if (left < plen) { - do { - pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | - VM_ALLOC_WIRED); - if (pg == NULL) - vm_wait(NULL); - } while (pg == NULL); + pg = vm_page_alloc_noobj(VM_ALLOC_WAITOK | VM_ALLOC_NODUMP | + VM_ALLOC_WIRED); m2->m_epg_pa[0] = VM_PAGE_TO_PHYS(pg); m2->m_epg_npgs = 1; diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index b39f1c6f0a55..31afca35c080 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -2057,7 +2057,6 @@ __CONCAT(PMTYPE, pinit0)(pmap_t pmap) static int __CONCAT(PMTYPE, pinit)(pmap_t pmap) { - vm_page_t m; int i; /* @@ -2085,11 +2084,10 @@ __CONCAT(PMTYPE, pinit)(pmap_t pmap) * allocate the page directory page(s) */ for (i = 0; i < NPGPTD; i++) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); - pmap->pm_ptdpg[i] = m; + pmap->pm_ptdpg[i] = vm_page_alloc_noobj(VM_ALLOC_WIRED | + VM_ALLOC_ZERO | VM_ALLOC_WAITOK); #ifdef PMAP_PAE_COMP - pmap->pm_pdpt[i] = VM_PAGE_TO_PHYS(m) | PG_V; + pmap->pm_pdpt[i] = VM_PAGE_TO_PHYS(pmap->pm_ptdpg[i]) | PG_V; #endif } @@ -2103,10 +2101,6 @@ __CONCAT(PMTYPE, pinit)(pmap_t pmap) } #endif - for (i = 0; i < NPGPTD; i++) - if ((pmap->pm_ptdpg[i]->flags & PG_ZERO) == 0) - pagezero(pmap->pm_pdir + (i * NPDEPG)); - /* Install the trampoline mapping. */ pmap->pm_pdir[TRPTDI] = PTD[TRPTDI]; @@ -2130,8 +2124,7 @@ _pmap_allocpte(pmap_t pmap, u_int ptepindex, u_int flags) /* * Allocate a page table page. */ - if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { + if ((m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { if ((flags & PMAP_ENTER_NOSLEEP) == 0) { PMAP_UNLOCK(pmap); rw_wunlock(&pvh_global_lock); @@ -2146,8 +2139,7 @@ _pmap_allocpte(pmap_t pmap, u_int ptepindex, u_int flags) */ return (NULL); } - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); + m->pindex = ptepindex; /* * Map the pagetable page into the process address space, if @@ -2271,16 +2263,13 @@ __CONCAT(PMTYPE, growkernel)(vm_offset_t addr) continue; } - nkpg = vm_page_alloc(NULL, kernel_vm_end >> PDRSHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - + nkpg->pindex = kernel_vm_end >> PDRSHIFT; nkpt++; - if ((nkpg->flags & PG_ZERO) == 0) - pmap_zero_page(nkpg); ptppaddr = VM_PAGE_TO_PHYS(nkpg); newpdir = (pd_entry_t) (ptppaddr | PG_V | PG_RW | PG_A | PG_M); pdir_pde(KPTD, kernel_vm_end) = newpdir; @@ -2575,8 +2564,8 @@ retry: * global lock. If "pv_vafree" is currently non-empty, it will * remain non-empty until pmap_ptelist_alloc() completes. */ - if (pv_vafree == 0 || (m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + if (pv_vafree == 0 || + (m = vm_page_alloc_noobj(VM_ALLOC_WIRED)) == NULL) { if (try) { pv_entry_count--; PV_STAT(pc_chunk_tryfail++); @@ -2808,9 +2797,8 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) * "failure" if the mapping was never accessed or the * allocation of the new page table page fails. */ - if ((oldpde & PG_A) == 0 || (mpte = vm_page_alloc(NULL, - va >> PDRSHIFT, VM_ALLOC_NOOBJ | VM_ALLOC_NORMAL | - VM_ALLOC_WIRED)) == NULL) { + if ((oldpde & PG_A) == 0 || + (mpte = vm_page_alloc_noobj(VM_ALLOC_WIRED)) == NULL) { SLIST_INIT(&free); sva = trunc_4mpage(va); pmap_remove_pde(pmap, pde, sva, &free); @@ -2821,6 +2809,7 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) " in pmap %p", va, pmap); return (FALSE); } + mpte->pindex = va >> PDRSHIFT; if (pmap != kernel_pmap) { mpte->ref_count = NPTEPG; pmap->pm_stats.resident_count++; @@ -5914,8 +5903,7 @@ pmap_trm_import(void *unused __unused, vmem_size_t size, int flags, prev_addr += trm_guard; trm_pte = PTmap + atop(prev_addr); for (af = prev_addr; af < addr; af += PAGE_SIZE) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NOOBJ | VM_ALLOC_NOBUSY | - VM_ALLOC_NORMAL | VM_ALLOC_WIRED | VM_ALLOC_WAITOK); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_WAITOK); pte_store(&trm_pte[atop(af - prev_addr)], VM_PAGE_TO_PHYS(m) | PG_M | PG_A | PG_RW | PG_V | pgeflag | pmap_cache_bits(kernel_pmap, VM_MEMATTR_DEFAULT, FALSE)); @@ -5934,10 +5922,8 @@ pmap_init_trm(void) trm_guard = 0; pmap_trm_arena = vmem_create("i386trampoline", 0, 0, 1, 0, M_WAITOK); vmem_set_import(pmap_trm_arena, pmap_trm_import, NULL, NULL, PAGE_SIZE); - pd_m = vm_page_alloc(NULL, 0, VM_ALLOC_NOOBJ | VM_ALLOC_NOBUSY | - VM_ALLOC_NORMAL | VM_ALLOC_WIRED | VM_ALLOC_WAITOK | VM_ALLOC_ZERO); - if ((pd_m->flags & PG_ZERO) == 0) - pmap_zero_page(pd_m); + pd_m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_WAITOK | + VM_ALLOC_ZERO); PTD[TRPTDI] = VM_PAGE_TO_PHYS(pd_m) | PG_M | PG_A | PG_RW | PG_V | pmap_cache_bits(kernel_pmap, VM_MEMATTR_DEFAULT, TRUE); } diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index 3b202bf3aab7..4e818d87a756 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -1584,8 +1584,8 @@ mb_alloc_ext_plus_pages(int len, int how) npgs = howmany(len, PAGE_SIZE); for (i = 0; i < npgs; i++) { do { - pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | VM_ALLOC_WIRED); + pg = vm_page_alloc_noobj(VM_ALLOC_NODUMP | + VM_ALLOC_WIRED); if (pg == NULL) { if (how == M_NOWAIT) { m->m_epg_npgs = i; diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index c6fc33b3109c..17c199230d0a 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -2037,8 +2037,8 @@ ktls_encrypt(struct mbuf *top) continue; } retry_page: - pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | VM_ALLOC_WIRED); + pg = vm_page_alloc_noobj(VM_ALLOC_NODUMP | + VM_ALLOC_WIRED); if (pg == NULL) { vm_wait(NULL); goto retry_page; diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 1a2098c7c536..5588da2dcd20 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1757,8 +1757,7 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, int maxseg, int flags) vm_page_t pg_array[MBUF_PEXT_MAX_PGS]; int error, length, i, needed; ssize_t total; - int pflags = malloc2vm_flags(how) | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | - VM_ALLOC_WIRED; + int pflags = malloc2vm_flags(how) | VM_ALLOC_NODUMP | VM_ALLOC_WIRED; MPASS((flags & M_PKTHDR) == 0); MPASS((how & M_ZERO) == 0); @@ -1806,7 +1805,7 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, int maxseg, int flags) needed = length = MIN(maxseg, total); for (i = 0; needed > 0; i++, needed -= PAGE_SIZE) { retry_page: - pg_array[i] = vm_page_alloc(NULL, 0, pflags); + pg_array[i] = vm_page_alloc_noobj(pflags); if (pg_array[i] == NULL) { if (how & M_NOWAIT) { goto failed; diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index d610f391de98..6ce445cbf2ee 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -4910,9 +4910,8 @@ vm_hold_load_pages(struct buf *bp, vm_offset_t from, vm_offset_t to) * could interfere with paging I/O, no matter which * process we are. */ - p = vm_page_alloc(NULL, 0, VM_ALLOC_SYSTEM | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_COUNT((to - pg) >> PAGE_SHIFT) | - VM_ALLOC_WAITOK); + p = vm_page_alloc_noobj(VM_ALLOC_SYSTEM | VM_ALLOC_WIRED | + VM_ALLOC_COUNT((to - pg) >> PAGE_SHIFT) | VM_ALLOC_WAITOK); pmap_qenter(pg, &p, 1); bp->b_pages[index] = p; } diff --git a/sys/mips/mips/pmap.c b/sys/mips/mips/pmap.c index 8b0eb1a3ce0b..9ca43048ecca 100644 --- a/sys/mips/mips/pmap.c +++ b/sys/mips/mips/pmap.c @@ -1115,10 +1115,6 @@ pmap_alloc_direct_page(unsigned int index, int req) VM_ALLOC_ZERO); if (m == NULL) return (NULL); - - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - m->pindex = index; return (m); } diff --git a/sys/mips/mips/uma_machdep.c b/sys/mips/mips/uma_machdep.c index 5b57447edd6a..321804d634d5 100644 --- a/sys/mips/mips/uma_machdep.c +++ b/sys/mips/mips/uma_machdep.c @@ -75,8 +75,6 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, if ((wait & M_NODUMP) == 0) dump_add_page(pa); va = (void *)MIPS_PHYS_TO_DIRECT(pa); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero(va, PAGE_SIZE); return (va); } diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index 3faa3d0752b8..2f7f6ce29422 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -1922,8 +1922,8 @@ moea64_uma_page_alloc(uma_zone_t zone, vm_size_t bytes, int domain, *flags = UMA_SLAB_PRIV; needed_lock = !PMAP_LOCKED(kernel_pmap); - m = vm_page_alloc_domain(NULL, 0, domain, - malloc2vm_flags(wait) | VM_ALLOC_WIRED | VM_ALLOC_NOOBJ); + m = vm_page_alloc_noobj_domain(domain, malloc2vm_flags(wait) | + VM_ALLOC_WIRED); if (m == NULL) return (NULL); @@ -1945,9 +1945,6 @@ moea64_uma_page_alloc(uma_zone_t zone, vm_size_t bytes, int domain, if (needed_lock) PMAP_UNLOCK(kernel_pmap); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero((void *)va, PAGE_SIZE); - return (void *)va; } diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index b9ca10448f9f..6dba22f2cd0f 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -1206,8 +1206,7 @@ retry: break; } for (reclaimed = false; avail < needed; avail += _NPCPV) { - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { m = reclaim_pv_chunk(pmap, lockp); if (m == NULL) @@ -1629,8 +1628,7 @@ retry: } } /* No free items, allocate another chunk */ - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED); + m = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (m == NULL) { if (lockp == NULL) { PV_STAT(pc_chunk_tryfail++); @@ -3503,13 +3501,11 @@ mmu_radix_growkernel(vm_offset_t addr) l2e = pmap_pml2e(kernel_pmap, kernel_vm_end); if ((be64toh(*l2e) & PG_V) == 0) { /* We need a new PDP entry */ - nkpg = vm_page_alloc(NULL, kernel_vm_end >> L2_PAGE_SIZE_SHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - mmu_radix_zero_page(nkpg); + nkpg->pindex = kernel_vm_end >> L2_PAGE_SIZE_SHIFT; paddr = VM_PAGE_TO_PHYS(nkpg); pde_store(l2e, paddr); continue; /* try again */ @@ -3524,13 +3520,11 @@ mmu_radix_growkernel(vm_offset_t addr) continue; } - nkpg = vm_page_alloc(NULL, pmap_l3e_pindex(kernel_vm_end), - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - mmu_radix_zero_page(nkpg); + nkpg->pindex = pmap_l3e_pindex(kernel_vm_end); paddr = VM_PAGE_TO_PHYS(nkpg); pde_store(l3e, paddr); @@ -4217,8 +4211,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) /* * Allocate a page table page. */ - if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { + if ((m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { if (lockp != NULL) { RELEASE_PV_LIST_LOCK(lockp); PMAP_UNLOCK(pmap); @@ -4231,8 +4224,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) */ return (NULL); } - if ((m->flags & PG_ZERO) == 0) - mmu_radix_zero_page(m); + m->pindex = ptepindex; /* * Map the pagetable page into the process address space, if @@ -4889,10 +4881,9 @@ pmap_demote_l3e_locked(pmap_t pmap, pml3_entry_t *l3e, vm_offset_t va, * is the only part of the kernel address space that must be * handled here. */ - if ((oldpde & PG_A) == 0 || (mpte = vm_page_alloc(NULL, - pmap_l3e_pindex(va), (va >= DMAP_MIN_ADDRESS && va < - DMAP_MAX_ADDRESS ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + if ((oldpde & PG_A) == 0 || (mpte = vm_page_alloc_noobj( + (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS ? + VM_ALLOC_INTERRUPT : 0) | VM_ALLOC_WIRED)) == NULL) { SLIST_INIT(&free); sva = trunc_2mpage(va); pmap_remove_l3e(pmap, l3e, sva, &free, lockp); @@ -4902,6 +4893,7 @@ pmap_demote_l3e_locked(pmap_t pmap, pml3_entry_t *l3e, vm_offset_t va, " in pmap %p", va, pmap); return (FALSE); } + mpte->pindex = pmap_l3e_pindex(va); if (va < VM_MAXUSER_ADDRESS) pmap_resident_count_inc(pmap, 1); } @@ -5921,13 +5913,13 @@ pmap_demote_l2e(pmap_t pmap, pml2_entry_t *l2e, vm_offset_t va) oldpdpe = be64toh(*l2e); KASSERT((oldpdpe & (RPTE_LEAF | PG_V)) == (RPTE_LEAF | PG_V), ("pmap_demote_pdpe: oldpdpe is missing PG_PS and/or PG_V")); - pdpg = vm_page_alloc(NULL, va >> L2_PAGE_SIZE_SHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + pdpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED); if (pdpg == NULL) { CTR2(KTR_PMAP, "pmap_demote_pdpe: failure for va %#lx" " in pmap %p", va, pmap); return (FALSE); } + pdpg->pindex = va >> L2_PAGE_SIZE_SHIFT; pdpgpa = VM_PAGE_TO_PHYS(pdpg); firstpde = (pml3_entry_t *)PHYS_TO_DMAP(pdpgpa); KASSERT((oldpdpe & PG_A) != 0, diff --git a/sys/powerpc/booke/pmap_32.c b/sys/powerpc/booke/pmap_32.c index a9f8af0565f0..fa9e0a6422d8 100644 --- a/sys/powerpc/booke/pmap_32.c +++ b/sys/powerpc/booke/pmap_32.c @@ -264,8 +264,7 @@ ptbl_alloc(pmap_t pmap, unsigned int pdir_idx, boolean_t nosleep) for (i = 0; i < PTBL_PAGES; i++) { pidx = (PTBL_PAGES * pdir_idx) + i; - while ((m = vm_page_alloc(NULL, pidx, - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + while ((m = vm_page_alloc_noobj(VM_ALLOC_WIRED)) == NULL) { if (nosleep) { ptbl_free_pmap_ptbl(pmap, ptbl); for (j = 0; j < i; j++) @@ -279,6 +278,7 @@ ptbl_alloc(pmap_t pmap, unsigned int pdir_idx, boolean_t nosleep) rw_wlock(&pvh_global_lock); PMAP_LOCK(pmap); *** 314 LINES SKIPPED ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111031754.1A3Hs1KZ029319>