x86/mm/pat: Make split_page_count() check for empty levels to fix /proc/meminfo output
authorDave Jones <[email protected]>
Mon, 11 Jan 2016 17:04:28 +0000 (12:04 -0500)
committerIngo Molnar <[email protected]>
Tue, 12 Jan 2016 10:08:37 +0000 (11:08 +0100)
In CONFIG_PAGEALLOC_DEBUG=y builds, we disable 2M pages.

Unfortunatly when we split up mappings during boot,
split_page_count() doesn't take this into account, and
starts decrementing an empty direct_pages_count[] level.

This results in /proc/meminfo showing crazy things like:

  DirectMap2M:    18446744073709543424 kB

Signed-off-by: Dave Jones <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Brian Gerst <[email protected]>
Cc: Denys Vlasenko <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Luis R. Rodriguez <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Toshi Kani <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/mm/pageattr.c

index 6000ad7f560c399226f06612c406268ac6a68820..fc6a4c8f6e2abc79c29803264ad16a48067904e8 100644 (file)
@@ -66,6 +66,9 @@ void update_page_count(int level, unsigned long pages)
 
 static void split_page_count(int level)
 {
+       if (direct_pages_count[level] == 0)
+               return;
+
        direct_pages_count[level]--;
        direct_pages_count[level - 1] += PTRS_PER_PTE;
 }