From 081b8e203bb1db61ab34d868351e26c8e163c5cb Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 1 Aug 2014 17:09:50 +0000 Subject: [PATCH] Simplify the selection of the pvo_head and pvo allocation zone in moea_enter_locked() and moea64_enter(). Eliminate an unused variable from moea64_enter(). --- sys/powerpc/aim/mmu_oea.c | 20 +++++++------------- sys/powerpc/aim/mmu_oea64.c | 18 ++++-------------- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index 6adcfa5351d5..0113c653ae08 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -1152,7 +1152,13 @@ moea_enter_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, u_int pte_lo, pvo_flags; int error; - if (!moea_initialized) { + if (pmap_bootstrapped) + rw_assert(&pvh_global_lock, RA_WLOCKED); + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) + VM_OBJECT_ASSERT_LOCKED(m->object); + + if ((m->oflags & VPO_UNMANAGED) != 0 || !moea_initialized) { pvo_head = &moea_pvo_kunmanaged; zone = moea_upvo_zone; pvo_flags = 0; @@ -1161,18 +1167,6 @@ moea_enter_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, zone = moea_mpvo_zone; pvo_flags = PVO_MANAGED; } - if (pmap_bootstrapped) - rw_assert(&pvh_global_lock, RA_WLOCKED); - PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); - - /* XXX change the pvo head for unmanaged pages */ - if ((m->oflags & VPO_UNMANAGED) != 0) { - pvo_flags &= ~PVO_MANAGED; - pvo_head = &moea_pvo_kunmanaged; - zone = moea_upvo_zone; - } pte_lo = moea_calc_wimg(VM_PAGE_TO_PHYS(m), pmap_page_get_memattr(m)); diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index 39f5b9d9e143..00664affdd64 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -1289,33 +1289,23 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, vm_page_t m, { struct pvo_head *pvo_head; uma_zone_t zone; - vm_page_t pg; uint64_t pte_lo; u_int pvo_flags; int error; - if (!moea64_initialized) { + if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) + VM_OBJECT_ASSERT_LOCKED(m->object); + + if ((m->oflags & VPO_UNMANAGED) != 0 || !moea64_initialized) { pvo_head = NULL; - pg = NULL; zone = moea64_upvo_zone; pvo_flags = 0; } else { pvo_head = vm_page_to_pvoh(m); - pg = m; zone = moea64_mpvo_zone; pvo_flags = PVO_MANAGED; } - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); - - /* XXX change the pvo head for fake pages */ - if ((m->oflags & VPO_UNMANAGED) != 0) { - pvo_flags &= ~PVO_MANAGED; - pvo_head = NULL; - zone = moea64_upvo_zone; - } - pte_lo = moea64_calc_wimg(VM_PAGE_TO_PHYS(m), pmap_page_get_memattr(m)); if (prot & VM_PROT_WRITE) {