diff options
author | marcel <marcel@FreeBSD.org> | 2005-09-05 21:32:02 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2005-09-05 21:32:02 +0000 |
commit | b58a5b21d1a8858af6a491d282beae77c3fb4072 (patch) | |
tree | d230cd5c08298a4bdc07195cae100cda29f2bdc4 /sys/ia64 | |
parent | 37ed081c3560c54ce7ed9ba8a6836563c09609be (diff) | |
download | FreeBSD-src-b58a5b21d1a8858af6a491d282beae77c3fb4072.zip FreeBSD-src-b58a5b21d1a8858af6a491d282beae77c3fb4072.tar.gz |
o In pmap_remove_pte: always invalidate the page. Previously the page
was not invalidated if the PTE was not actually being removed. In
an UP kernel this didn't cause problems, because the new mapping
would preempt the old one. In an SMP kernel this could lead to the
use of stale translations when processes move between CPUs at the
"right" moment. This fixes the last of the obvious SMP problems
and it should be safe to enable SMP by default now.
o In pmap_remove_pte: minor code refactoring to avoid duplication.
o Test all PTE pointers against NULL. Don't use implicit boolean
tests.
Diffstat (limited to 'sys/ia64')
-rw-r--r-- | sys/ia64/ia64/pmap.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c index eff0598..284801f 100644 --- a/sys/ia64/ia64/pmap.c +++ b/sys/ia64/ia64/pmap.c @@ -1065,8 +1065,10 @@ pmap_find_pte(vm_offset_t va) return pmap_find_kpte(va); pte = pmap_find_vhpt(va); - if (!pte) + if (pte == NULL) { pte = uma_zalloc(ptezone, M_NOWAIT | M_ZERO); + pte->tag = 1UL << 63; + } return (pte); } @@ -1145,8 +1147,7 @@ pmap_remove_pte(pmap_t pmap, struct ia64_lpte *pte, vm_offset_t va, if (error) return (error); - if (freepte) - pmap_invalidate_page(pmap, va); + pmap_invalidate_page(pmap, va); if (pmap_wired(pte)) pmap->pm_stats.wired_count -= 1; @@ -1160,13 +1161,10 @@ pmap_remove_pte(pmap_t pmap, struct ia64_lpte *pte, vm_offset_t va, if (pmap_accessed(pte)) vm_page_flag_set(m, PG_REFERENCED); - if (freepte) - pmap_free_pte(pte, va); error = pmap_remove_entry(pmap, m, va, pv); - } else { - if (freepte) - pmap_free_pte(pte, va); } + if (freepte) + pmap_free_pte(pte, va); return (error); } @@ -1312,7 +1310,7 @@ pmap_remove_page(pmap_t pmap, vm_offset_t va) ("removing page for non-current pmap")); pte = pmap_find_vhpt(va); - if (pte) + if (pte != NULL) pmap_remove_pte(pmap, pte, va, 0, 1); return; } @@ -1361,7 +1359,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) } else { for (va = sva; va < eva; va = va += PAGE_SIZE) { pte = pmap_find_vhpt(va); - if (pte) + if (pte != NULL) pmap_remove_pte(pmap, pte, va, 0, 1); } } @@ -1454,7 +1452,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) * If page is invalid, skip this page */ pte = pmap_find_vhpt(sva); - if (!pte) { + if (pte == NULL) { sva += PAGE_SIZE; continue; } @@ -1984,7 +1982,7 @@ pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr) struct ia64_lpte *pte; pte = pmap_find_vhpt(addr); - if (pte && pmap_present(pte)) + if (pte != NULL && pmap_present(pte)) return (FALSE); return (TRUE); } @@ -2086,7 +2084,7 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr) pmap_install(oldpmap); PMAP_UNLOCK(pmap); - if (!pte) + if (pte == NULL) return 0; if (pmap_present(pte)) { |