aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/init_64.c
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2008-08-15 08:58:32 -0400
committerIngo Molnar <mingo@elte.hu>2008-08-15 09:27:55 -0400
commita06de63000b95e1ed1c6373a72376876c952608e (patch)
treebe0e7c23d8bc9de1f2c11a2128fb9f812e043e06 /arch/x86/mm/init_64.c
parent1c5b0eb66d74683e2be5da0c53e33c1f4ca982fd (diff)
x86: fix /proc/meminfo DirectMap
Do we actually want these DirectMap lines in the x86 /proc/meminfo? I can see they're interesting to CPA developers and TLB optimizers, but they don't fit its usual "where has all my memory gone?" usage. If they are to stay, here are some fixes. 1. On x86_32 without PAE, they're not 2M but 4M pages: no need to mess with the internal enum, but show the right name to users. 2. Many machines can never show anything but 0 for DirectMap1G, so suppress that line unless direct_gbpages are really enabled. 3. The unit in /proc/meminfo is kB not number of pages: HugePages messed that up, but they're an example to regret not to follow. 4. Once we use kB, it's easy to see that 1GB has gone missing (which explains why CONFIG_CPA_DEBUG=y soon wraps DirectMap2M negative): because head_64.S's level2_ident_pgt entries were not counted. My fix is not ideal, but works for more and for less than 1G, and avoids interfering with early bootup pagetable contortions. Signed-off-by: Hugh Dickins <hugh@veritas.com> Cc: Andi Kleen <andi@firstfloor.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm/init_64.c')
-rw-r--r--arch/x86/mm/init_64.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 129618ca0ea2..b3e6c3075acc 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -60,7 +60,7 @@ static unsigned long dma_reserve __initdata;
60 60
61DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 61DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
62 62
63int direct_gbpages __meminitdata 63int direct_gbpages
64#ifdef CONFIG_DIRECT_GBPAGES 64#ifdef CONFIG_DIRECT_GBPAGES
65 = 1 65 = 1
66#endif 66#endif
@@ -314,6 +314,7 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
314{ 314{
315 unsigned long pages = 0; 315 unsigned long pages = 0;
316 unsigned long last_map_addr = end; 316 unsigned long last_map_addr = end;
317 unsigned long start = address;
317 318
318 int i = pmd_index(address); 319 int i = pmd_index(address);
319 320
@@ -334,6 +335,9 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
334 if (!pmd_large(*pmd)) 335 if (!pmd_large(*pmd))
335 last_map_addr = phys_pte_update(pmd, address, 336 last_map_addr = phys_pte_update(pmd, address,
336 end); 337 end);
338 /* Count entries we're using from level2_ident_pgt */
339 if (start == 0)
340 pages++;
337 continue; 341 continue;
338 } 342 }
339 343