Date: Thu, 8 Aug 2019 03:18:36 +0000 (UTC) From: Justin Hibbits <jhibbits@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350738 - head/sys/powerpc/booke Message-ID: <201908080318.x783Iabd070183@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhibbits Date: Thu Aug 8 03:18:35 2019 New Revision: 350738 URL: https://svnweb.freebsd.org/changeset/base/350738 Log: powerpc/pmap: Minor optimizations to 64-bit booke pmap Don't recalculate the VM page of the page table pages, just pass them down to free. Also, use the pmap's page zero function instead of bzero(). Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Thu Aug 8 03:16:32 2019 (r350737) +++ head/sys/powerpc/booke/pmap.c Thu Aug 8 03:18:35 2019 (r350738) @@ -264,7 +264,7 @@ static int pv_entry_count = 0, pv_entry_max = 0, pv_en #ifdef __powerpc64__ static pte_t *ptbl_alloc(mmu_t, pmap_t, pte_t **, unsigned int, boolean_t); -static void ptbl_free(mmu_t, pmap_t, pte_t **, unsigned int); +static void ptbl_free(mmu_t, pmap_t, pte_t **, unsigned int, vm_page_t); static void ptbl_hold(mmu_t, pmap_t, pte_t **, unsigned int); static int ptbl_unhold(mmu_t, pmap_t, vm_offset_t); #else @@ -615,19 +615,16 @@ pdir_alloc(mmu_t mmu, pmap_t pmap, unsigned int pp2d_i /* Zero whole ptbl. */ pdir = (pte_t **)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); - bzero(pdir, PAGE_SIZE); + mmu_booke_zero_page(mmu, m); return (pdir); } /* Free pdir pages and invalidate pdir entry. */ static void -pdir_free(mmu_t mmu, pmap_t pmap, unsigned int pp2d_idx) +pdir_free(mmu_t mmu, pmap_t pmap, unsigned int pp2d_idx, vm_page_t m) { pte_t **pdir; - vm_paddr_t pa; - vm_offset_t va; - vm_page_t m; pdir = pmap->pm_pp2d[pp2d_idx]; @@ -635,9 +632,6 @@ pdir_free(mmu_t mmu, pmap_t pmap, unsigned int pp2d_id pmap->pm_pp2d[pp2d_idx] = NULL; - va = (vm_offset_t) pdir; - pa = DMAP_TO_PHYS(va); - m = PHYS_TO_VM_PAGE(pa); vm_page_free_zero(m); } @@ -667,7 +661,7 @@ pdir_unhold(mmu_t mmu, pmap_t pmap, u_int pp2d_idx) * Free pdir page if there are no dir entries in this pdir. */ if (vm_page_unwire_noq(m)) { - pdir_free(mmu, pmap, pp2d_idx); + pdir_free(mmu, pmap, pp2d_idx, m); return (1); } return (0); @@ -717,19 +711,16 @@ ptbl_alloc(mmu_t mmu, pmap_t pmap, pte_t ** pdir, unsi /* Zero whole ptbl. */ ptbl = (pte_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); - bzero(ptbl, PAGE_SIZE); + mmu_booke_zero_page(mmu, m); return (ptbl); } /* Free ptbl pages and invalidate pdir entry. */ static void -ptbl_free(mmu_t mmu, pmap_t pmap, pte_t ** pdir, unsigned int pdir_idx) +ptbl_free(mmu_t mmu, pmap_t pmap, pte_t ** pdir, unsigned int pdir_idx, vm_page_t m) { pte_t *ptbl; - vm_paddr_t pa; - vm_offset_t va; - vm_page_t m; ptbl = pdir[pdir_idx]; @@ -737,9 +728,6 @@ ptbl_free(mmu_t mmu, pmap_t pmap, pte_t ** pdir, unsig pdir[pdir_idx] = NULL; - va = (vm_offset_t) ptbl; - pa = DMAP_TO_PHYS(va); - m = PHYS_TO_VM_PAGE(pa); vm_page_free_zero(m); } @@ -776,7 +764,7 @@ ptbl_unhold(mmu_t mmu, pmap_t pmap, vm_offset_t va) * last page. */ if (vm_page_unwire_noq(m)) { - ptbl_free(mmu, pmap, pdir, pdir_idx); + ptbl_free(mmu, pmap, pdir, pdir_idx, m); pdir_unhold(mmu, pmap, pp2d_idx); return (1); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908080318.x783Iabd070183>