diff options
author | Kurt Miller <kurt@cvs.openbsd.org> | 2008-11-24 03:13:23 +0000 |
---|---|---|
committer | Kurt Miller <kurt@cvs.openbsd.org> | 2008-11-24 03:13:23 +0000 |
commit | 6e36029167f479641684e533993ff7e2226f6e81 (patch) | |
tree | 97aa36402114d118dbdbb3f40109cc0fc05a7694 | |
parent | fb010ee28f3f39c9cf5fe72822a89213e428d32b (diff) |
In pmap_clear_attrs() use i386_atomic_clearbits_l() to only clear the
bits necessary. Also move up the pmap_map_ptes() call to before the
diagnostic check. okay art@, weingart@
-rw-r--r-- | sys/arch/i386/i386/pmap.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index cca35c21a64..4a76de411d0 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.128 2008/11/14 20:43:54 weingart Exp $ */ +/* $OpenBSD: pmap.c,v 1.129 2008/11/24 03:13:22 kurt Exp $ */ /* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */ /* @@ -2363,7 +2363,7 @@ boolean_t pmap_clear_attrs(struct vm_page *pg, int clearbits) { struct pv_entry *pve; - pt_entry_t *ptes, npte, opte; + pt_entry_t *ptes, opte; u_long clearflags; int result; @@ -2376,19 +2376,18 @@ pmap_clear_attrs(struct vm_page *pg, int clearbits) atomic_clearbits_int(&pg->pg_flags, clearflags); for (pve = pg->mdpage.pv_list; pve != NULL; pve = pve->pv_next) { + ptes = pmap_map_ptes(pve->pv_pmap); /* locks pmap */ #ifdef DIAGNOSTIC if (!pmap_valid_entry(pve->pv_pmap->pm_pdir[pdei(pve->pv_va)])) panic("pmap_change_attrs: mapping without PTP " "detected"); #endif - ptes = pmap_map_ptes(pve->pv_pmap); /* locks pmap */ - npte = ptes[atop(pve->pv_va)]; - if (npte & clearbits) { + opte = ptes[atop(pve->pv_va)]; + if (opte & clearbits) { result = TRUE; - npte &= ~clearbits; - opte = i386_atomic_testset_ul( - &ptes[atop(pve->pv_va)], npte); + i386_atomic_clearbits_l(&ptes[atop(pve->pv_va)], + (opte & clearbits)); pmap_tlb_shootpage(pve->pv_pmap, pve->pv_va); } pmap_unmap_ptes(pve->pv_pmap); /* unlocks pmap */ |