Skip to contentSkip to conversation

Make split_page_count check for empty levels.

x86 Dave Jones 2 participants 2 messages Jan 11, 2016 – Jan 12, 2016

Subsystems (2)
lore
Share & tools
lore

Dave Jones

author
#0 lore raw

In PAGEALLOC_DEBUG builds, we disable the 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

arch/x86/mm/pageattr.c +3 -0
index a3137a4feed1..ff0e0c6c350e 100644
@@ -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;
 }
#1 lore raw

[tip:x86/urgent] x86/mm: Make split_page_count check for empty levels

x86/mm: Make split_page_count check for empty levels
Commit-ID:  3f1ac1cdc4fdf894e35c0e4fd103b54eec8a28c0
Gitweb:     http://git.kernel.org/tip/3f1ac1cdc4fdf894e35c0e4fd103b54eec8a28c0
Author:     Dave Jones <[email protected]>
AuthorDate: Mon, 11 Jan 2016 12:04:28 -0500
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Tue, 12 Jan 2016 11:04:53 +0100

x86/mm: Make split_page_count check for empty levels

In PAGEALLOC_DEBUG builds, we disable the 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

---
 arch/x86/mm/pageattr.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/mm/pageattr.c +3 -0
index a3137a4..ff0e0c6 100644
@@ -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;
 }