diff options
author | Richard Braun <rbraun@sceen.net> | 2013-07-24 20:50:07 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2013-07-24 20:50:07 +0200 |
commit | f4b577ac00738ada2bd0880be646b6340151ecf0 (patch) | |
tree | 6b77add38a42249b1403afe35ee6c2ea3e96b3bc /arch | |
parent | e47931e0b48c106d14f78f27eb0215cd1239e8e5 (diff) |
x86/pmap: use pmap_walk_vas for PTEs accounting
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/machine/pmap.c | 45 |
1 files changed, 11 insertions, 34 deletions
diff --git a/arch/x86/machine/pmap.c b/arch/x86/machine/pmap.c index f392f85..c5c02f4 100644 --- a/arch/x86/machine/pmap.c +++ b/arch/x86/machine/pmap.c @@ -800,46 +800,23 @@ error_page: #endif /* X86_PAE */ static void __init -pmap_setup_count_ptes(void) +pmap_setup_inc_nr_ptes(pmap_pte_t *pte) { - const struct pmap_pt_level *pt_level; struct vm_page *page; - unsigned long va; - unsigned int level; - pmap_pte_t *pte; - va = 0; + page = vm_kmem_lookup_page(vm_page_trunc((unsigned long)pte)); + assert(page != NULL); + page->pmap_page.nr_ptes++; +} +static void __init +pmap_setup_count_ptes(void) +{ /* - * Only count entries at lowest level. Accounting on upper PTPs is done - * when walking the recursive mapping. + * This call count entries at the lowest level. Accounting on upper PTPs + * is done when walking the recursive mapping. */ - do { -#ifdef __LP64__ - /* Handle long mode canonical form */ - if (va == ((PMAP_VA_MASK >> 1) + 1)) - va = ~(PMAP_VA_MASK >> 1); -#endif /* __LP64__ */ - - for (level = PMAP_NR_LEVELS; level > 0; level--) { - pt_level = &pmap_pt_levels[level - 1]; - pte = &pt_level->ptes[PMAP_PTEMAP_INDEX(va, pt_level->shift)]; - - if (*pte == 0) { - pte = NULL; - va = P2END(va, 1UL << pt_level->shift); - break; - } - } - - if (pte == NULL) - continue; - - page = vm_kmem_lookup_page(vm_page_trunc((unsigned long)pte)); - assert(page != NULL); - page->pmap_page.nr_ptes++; - va += PAGE_SIZE; - } while (va != 0); + pmap_walk_vas(0, pmap_setup_inc_nr_ptes); } void __init |