diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2016-12-30 12:42:28 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2016-12-30 12:42:28 +0000 |
commit | 7e5420e714fb7f81fcaadf0ef02dbce0055d50ab (patch) | |
tree | 9f3ea6668e33e3434e88fdfc578bec32a9e09c6a /sys/arch/mips64 | |
parent | 50bd9cc2aff417ff9e1a496a1e7d1433f00b8c65 (diff) |
When entering a mapping on write access, compute the PTE after making
the page dirty. This lets the system avoid an extra TLB modify fault
because the TLB mapping now allows writes immediately.
Noticed by miod@
Diffstat (limited to 'sys/arch/mips64')
-rw-r--r-- | sys/arch/mips64/mips64/pmap.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/arch/mips64/mips64/pmap.c b/sys/arch/mips64/mips64/pmap.c index d59774cb27a..5f0d8c72f26 100644 --- a/sys/arch/mips64/mips64/pmap.c +++ b/sys/arch/mips64/mips64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.97 2016/12/23 12:38:16 visa Exp $ */ +/* $OpenBSD: pmap.c,v 1.98 2016/12/30 12:42:27 visa Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -1059,6 +1059,14 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags) if (pg != NULL) { mtx_enter(&pg->mdpage.pv_mtx); + + /* Set page referenced/modified status based on flags */ + if (flags & PROT_WRITE) + atomic_setbits_int(&pg->pg_flags, + PGF_ATTR_MOD | PGF_ATTR_REF); + else if (flags & PROT_MASK) + atomic_setbits_int(&pg->pg_flags, PGF_ATTR_REF); + if (!(prot & PROT_WRITE)) { npte = PG_ROPAGE; } else { @@ -1081,13 +1089,6 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags) npte |= PG_UNCACHED; } - /* Set page referenced/modified status based on flags */ - if (flags & PROT_WRITE) - atomic_setbits_int(&pg->pg_flags, - PGF_ATTR_MOD | PGF_ATTR_REF); - else if (flags & PROT_MASK) - atomic_setbits_int(&pg->pg_flags, PGF_ATTR_REF); - stat_count(enter_stats.managed); } else { /* |