Skip to contentSkip to conversation

weird DirectMap2M accounting.

DISCUSSION Dave Jones 2 participants 4 messages Jan 6, 2016 – Jan 11, 2016

Subsystems (2)
lore
Share & tools
lore

Dave Jones

author
#0 lore raw

I just spotted this in /proc/meminfo on an old Core2 machine with 4G.

DirectMap2M: 18446744073709543424 kB

Looks like we subtracted 8192 from 0 somewhere.

Should split_page_count() be checking that direct_pages_count > 0 ?

Dave

author
#1 lore raw
Quoted 7 lines · Dave Jones

I just spotted this in /proc/meminfo on an old Core2 machine with 4G.

DirectMap2M: 18446744073709543424 kB

Looks like we subtracted 8192 from 0 somewhere.

Should split_page_count() be checking that direct_pages_count > 0 ?

Ok, this diff makes that number print out as 0.

If this looks ok, I'll submit it properly, though I'd like to better understand what's happening here. Shouldn't I have 2M pages ?

Dave

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;
 }
author
#2 lore raw
Quoted 5 lines · Dave Jones
Quoted 4 lines · Dave Jones

I just spotted this in /proc/meminfo on an old Core2 machine with 4G.

DirectMap2M: 18446744073709543424 kB

Quoted 8 lines
Quoted 3 lines

Looks like we subtracted 8192 from 0 somewhere.

Should split_page_count() be checking that direct_pages_count > 0 ?

Ok, this diff makes that number print out as 0.

If this looks ok, I'll submit it properly, though I'd like to better understand what's happening here. Shouldn't I have 2M pages ?

Ah. We disable them when compiling with DEBUG_PAGEALLOC.
So this is only needed in that case.
If people think it's worth an ifdef for those two added lines I'll add it, but it seems pretty benign to just always check.

thoughts?

Dave

#3 lore raw
Quoted 12 lines · Dave Jones
Quoted 11 lines · Dave Jones
Quoted 7 lines · Dave Jones

I just spotted this in /proc/meminfo on an old Core2 machine with 4G.

DirectMap2M: 18446744073709543424 kB

Looks like we subtracted 8192 from 0 somewhere.

Should split_page_count() be checking that direct_pages_count > 0 ?

Ok, this diff makes that number print out as 0.

Quoted 7 lines
Quoted 2 lines

If this looks ok, I'll submit it properly, though I'd like to better understand what's happening here. Shouldn't I have 2M pages ?

Ah. We disable them when compiling with DEBUG_PAGEALLOC.
So this is only needed in that case.
If people think it's worth an ifdef for those two added lines I'll add it, but it seems pretty benign to just always check.

Agreed.

tglx