diff options
author | Yinghai Lu <yinghai@kernel.org> | 2008-10-26 01:58:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-27 13:55:26 -0400 |
commit | 3afa39493de510c33c56ddc76e6e1af7f87c5392 (patch) | |
tree | 4678eb36c691870f9adcb8ad085cd9503fb10e40 /arch/x86/mm | |
parent | ef020ab0109aa5cd6eac2e93519b7641c9862828 (diff) |
x86: keep the /proc/meminfo page count correct
Impact: get correct page count in /proc/meminfo
found page count in /proc/meminfo is nor correct on 1G system in VirtualBox 2.0.4
# cat /proc/meminfo
MemTotal: 1017508 kB
MemFree: 822700 kB
Buffers: 1456 kB
Cached: 26632 kB
SwapCached: 0 kB
...
Hugepagesize: 2048 kB
DirectMap4k: 4032 kB
DirectMap2M: 18446744073709549568 kB
with this patch get:
...
DirectMap4k: 4032 kB
DirectMap2M: 1044480 kB
which is consistent to kernel_page_tables
---[ Low Kernel Mapping ]---
0xffff880000000000-0xffff880000001000 4K RW PCD GLB x pte
0xffff880000001000-0xffff88000009f000 632K RW GLB x pte
0xffff88000009f000-0xffff8800000a0000 4K RW PCD GLB x pte
0xffff8800000a0000-0xffff880000200000 1408K RW GLB x pte
0xffff880000200000-0xffff88003fe00000 1020M RW PSE GLB x pmd
0xffff88003fe00000-0xffff88003fff0000 1984K RW GLB NX pte
0xffff88003fff0000-0xffff880040000000 64K pte
0xffff880040000000-0xffff888000000000 511G pud
0xffff888000000000-0xffffc20000000000 58880G pgd
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/init_64.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index b8e461d49412..c7a4c5a9a21b 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -350,8 +350,10 @@ phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end, | |||
350 | * pagetable pages as RO. So assume someone who pre-setup | 350 | * pagetable pages as RO. So assume someone who pre-setup |
351 | * these mappings are more intelligent. | 351 | * these mappings are more intelligent. |
352 | */ | 352 | */ |
353 | if (pte_val(*pte)) | 353 | if (pte_val(*pte)) { |
354 | pages++; | ||
354 | continue; | 355 | continue; |
356 | } | ||
355 | 357 | ||
356 | if (0) | 358 | if (0) |
357 | printk(" pte=%p addr=%lx pte=%016lx\n", | 359 | printk(" pte=%p addr=%lx pte=%016lx\n", |
@@ -418,8 +420,10 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, | |||
418 | * not differ with respect to page frame and | 420 | * not differ with respect to page frame and |
419 | * attributes. | 421 | * attributes. |
420 | */ | 422 | */ |
421 | if (page_size_mask & (1 << PG_LEVEL_2M)) | 423 | if (page_size_mask & (1 << PG_LEVEL_2M)) { |
424 | pages++; | ||
422 | continue; | 425 | continue; |
426 | } | ||
423 | new_prot = pte_pgprot(pte_clrhuge(*(pte_t *)pmd)); | 427 | new_prot = pte_pgprot(pte_clrhuge(*(pte_t *)pmd)); |
424 | } | 428 | } |
425 | 429 | ||
@@ -499,8 +503,10 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end, | |||
499 | * not differ with respect to page frame and | 503 | * not differ with respect to page frame and |
500 | * attributes. | 504 | * attributes. |
501 | */ | 505 | */ |
502 | if (page_size_mask & (1 << PG_LEVEL_1G)) | 506 | if (page_size_mask & (1 << PG_LEVEL_1G)) { |
507 | pages++; | ||
503 | continue; | 508 | continue; |
509 | } | ||
504 | prot = pte_pgprot(pte_clrhuge(*(pte_t *)pud)); | 510 | prot = pte_pgprot(pte_clrhuge(*(pte_t *)pud)); |
505 | } | 511 | } |
506 | 512 | ||