Date: Sat, 6 Oct 2012 19:05:50 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241276 - head/sys/mips/mips Message-ID: <201210061905.q96J5of9021825@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Sat Oct 6 19:05:50 2012 New Revision: 241276 URL: http://svn.freebsd.org/changeset/base/241276 Log: Correct two pessimizations in pmap_extract_and_hold(). Test the PTE for having PTE_RO set instead of PTE_D. This avoids some unnecessary failures by pmap_extract_and_hold() that will have to be handled by a call to vm_fault_hold(). Testing the PTE for both being non-zero and having PTE_V set is redundant. The latter suffices. Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Sat Oct 6 19:01:31 2012 (r241275) +++ head/sys/mips/mips/pmap.c Sat Oct 6 19:05:50 2012 (r241276) @@ -791,24 +791,25 @@ pmap_extract(pmap_t pmap, vm_offset_t va vm_page_t pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot) { - pt_entry_t *ptep; - pt_entry_t pte; + pt_entry_t pte, *ptep; + vm_paddr_t pa, pte_pa; vm_page_t m; - vm_paddr_t pa; m = NULL; pa = 0; PMAP_LOCK(pmap); retry: ptep = pmap_pte(pmap, va); - if ((ptep != NULL) && ((pte = *ptep) != 0) && - pte_test(&pte, PTE_V) && - (pte_test(&pte, PTE_D) || (prot & VM_PROT_WRITE) == 0)) { - if (vm_page_pa_tryrelock(pmap, TLBLO_PTE_TO_PA(pte), &pa)) - goto retry; - - m = PHYS_TO_VM_PAGE(TLBLO_PTE_TO_PA(pte)); - vm_page_hold(m); + if (ptep != NULL) { + pte = *ptep; + if (pte_test(&pte, PTE_V) && (!pte_test(&pte, PTE_RO) || + (prot & VM_PROT_WRITE) == 0)) { + pte_pa = TLBLO_PTE_TO_PA(pte); + if (vm_page_pa_tryrelock(pmap, pte_pa, &pa)) + goto retry; + m = PHYS_TO_VM_PAGE(pte_pa); + vm_page_hold(m); + } } PA_UNLOCK_COND(pa); PMAP_UNLOCK(pmap);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210061905.q96J5of9021825>