diff options
author | jchandra <jchandra@FreeBSD.org> | 2010-08-06 07:32:33 +0000 |
---|---|---|
committer | jchandra <jchandra@FreeBSD.org> | 2010-08-06 07:32:33 +0000 |
commit | c17c1b915d3111d18a76bf56ac4f95d6a2cf5c17 (patch) | |
tree | e0f0fcc88e0e111a74d1986fc32557144318d35f /sys | |
parent | 6639a8f4cb6eacd78ac589888cd2475908d6d243 (diff) | |
download | FreeBSD-src-c17c1b915d3111d18a76bf56ac4f95d6a2cf5c17.zip FreeBSD-src-c17c1b915d3111d18a76bf56ac4f95d6a2cf5c17.tar.gz |
Fix the issue reported by alc:
pmap_page_wired_mappings() counts the number of pv entries for the
specified page that have the pv entry wired flag set to TRUE.
pmap_enter() correctly initializes this flag. However,
pmap_change_wiring() doesn't update the corresponding pv entry flag,
only the PTE. So, the count returned by pmap_page_wired_mappings()
will sometimes be wrong.
In the short term, the best fix would be to eliminate the pv entry
flag and use only the PTE. That flag is wasting non-trivial memory.
Remove pv_wired flag, and use PTE flag to count the wired mappings.
Reviewed by: alc
Diffstat (limited to 'sys')
-rw-r--r-- | sys/mips/include/pmap.h | 1 | ||||
-rw-r--r-- | sys/mips/mips/pmap.c | 15 |
2 files changed, 10 insertions, 6 deletions
diff --git a/sys/mips/include/pmap.h b/sys/mips/include/pmap.h index 3e7b937..0b4ef8a 100644 --- a/sys/mips/include/pmap.h +++ b/sys/mips/include/pmap.h @@ -124,7 +124,6 @@ typedef struct pv_entry { TAILQ_ENTRY(pv_entry) pv_list; TAILQ_ENTRY(pv_entry) pv_plist; vm_page_t pv_ptem; /* VM page for pte */ - boolean_t pv_wired; /* whether this entry is wired */ } *pv_entry_t; diff --git a/sys/mips/mips/pmap.c b/sys/mips/mips/pmap.c index f6b7e6f..ecba6ff 100644 --- a/sys/mips/mips/pmap.c +++ b/sys/mips/mips/pmap.c @@ -1473,7 +1473,6 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm_page_t mpte, vm_offset_t va, pv->pv_va = va; pv->pv_pmap = pmap; pv->pv_ptem = mpte; - pv->pv_wired = FALSE; TAILQ_INSERT_TAIL(&pmap->pm_pvlist, pv, pv_plist); TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); m->md.pv_list_count++; @@ -1897,7 +1896,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_prot_t access, vm_page_t m, pv->pv_va = va; pv->pv_pmap = pmap; pv->pv_ptem = mpte; - pv->pv_wired = wired; TAILQ_INSERT_TAIL(&pmap->pm_pvlist, pv, pv_plist); TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); m->md.pv_list_count++; @@ -2655,15 +2653,22 @@ int pmap_page_wired_mappings(vm_page_t m) { pv_entry_t pv; + pmap_t pmap; + pt_entry_t *pte; int count; count = 0; if ((m->flags & PG_FICTITIOUS) != 0) return (count); vm_page_lock_queues(); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) - if (pv->pv_wired) - count++; + TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + pmap = pv->pv_pmap; + PMAP_LOCK(pmap); + pte = pmap_pte(pmap, pv->pv_va); + if (pte_test(pte, PTE_W)) + count++; + PMAP_UNLOCK(pmap); + } vm_page_unlock_queues(); return (count); } |