diff options
author | Andi Kleen <andi@firstfloor.org> | 2008-05-02 05:46:49 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 02:11:45 -0400 |
commit | ce0c0e50f94e8c55b00a722e8c6e8d6c802be211 (patch) | |
tree | cd8917c9f7917c75d2c65f2eaa2e4d4c60794bef /arch/x86/mm/init_32.c | |
parent | 1b40a895df6c7d5a80e71f65674060b03d84bbef (diff) |
x86, generic: CPA add statistics about state of direct mapping v4
Add information about the mapping state of the direct mapping to
/proc/meminfo. I chose /proc/meminfo because that is where all the other
memory statistics are too and it is a generally useful metric even
outside debugging situations. A lot of split kernel pages means the
kernel will run slower.
This way we can see how many large pages are really used for it and how
many are split.
Useful for general insight into the kernel.
v2: Add hotplug locking to 64bit to plug a very obscure theoretical race.
32bit doesn't need it because it doesn't support hotadd for lowmem.
Fix some typos
v3: Rename dpages_cnt
Add CONFIG ifdef for count update as requested by tglx
Expand description
v4: Fix stupid bugs added in v3
Move update_page_count to pageattr.c
Signed-off-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm/init_32.c')
-rw-r--r-- | arch/x86/mm/init_32.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index ec30d10154b6..0269ac230bfa 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -162,6 +162,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base) | |||
162 | pgd_t *pgd; | 162 | pgd_t *pgd; |
163 | pmd_t *pmd; | 163 | pmd_t *pmd; |
164 | pte_t *pte; | 164 | pte_t *pte; |
165 | unsigned pages_2m = 0, pages_4k = 0; | ||
165 | 166 | ||
166 | pgd_idx = pgd_index(PAGE_OFFSET); | 167 | pgd_idx = pgd_index(PAGE_OFFSET); |
167 | pgd = pgd_base + pgd_idx; | 168 | pgd = pgd_base + pgd_idx; |
@@ -197,6 +198,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base) | |||
197 | is_kernel_text(addr2)) | 198 | is_kernel_text(addr2)) |
198 | prot = PAGE_KERNEL_LARGE_EXEC; | 199 | prot = PAGE_KERNEL_LARGE_EXEC; |
199 | 200 | ||
201 | pages_2m++; | ||
200 | set_pmd(pmd, pfn_pmd(pfn, prot)); | 202 | set_pmd(pmd, pfn_pmd(pfn, prot)); |
201 | 203 | ||
202 | pfn += PTRS_PER_PTE; | 204 | pfn += PTRS_PER_PTE; |
@@ -213,11 +215,14 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base) | |||
213 | if (is_kernel_text(addr)) | 215 | if (is_kernel_text(addr)) |
214 | prot = PAGE_KERNEL_EXEC; | 216 | prot = PAGE_KERNEL_EXEC; |
215 | 217 | ||
218 | pages_4k++; | ||
216 | set_pte(pte, pfn_pte(pfn, prot)); | 219 | set_pte(pte, pfn_pte(pfn, prot)); |
217 | } | 220 | } |
218 | max_pfn_mapped = pfn; | 221 | max_pfn_mapped = pfn; |
219 | } | 222 | } |
220 | } | 223 | } |
224 | update_page_count(PG_LEVEL_2M, pages_2m); | ||
225 | update_page_count(PG_LEVEL_4K, pages_4k); | ||
221 | } | 226 | } |
222 | 227 | ||
223 | static inline int page_kills_ppro(unsigned long pagenr) | 228 | static inline int page_kills_ppro(unsigned long pagenr) |