All of lore.kernel.org
 help / color / mirror / Atom feed
* weird DirectMap2M accounting.
@ 2016-01-06 23:55 Dave Jones
  2016-01-07  0:11 ` Dave Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Jones @ 2016-01-06 23:55 UTC (permalink / raw)
  To: Linux Kernel; +Cc: x86

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: weird DirectMap2M accounting.
  2016-01-06 23:55 weird DirectMap2M accounting Dave Jones
@ 2016-01-07  0:11 ` Dave Jones
  2016-01-07  0:18   ` Dave Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Jones @ 2016-01-07  0:11 UTC (permalink / raw)
  To: Linux Kernel, x86

On Wed, Jan 06, 2016 at 06:55:27PM -0500, Dave Jones wrote:
 > 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


diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index a3137a4feed1..ff0e0c6c350e 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -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;
 }
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: weird DirectMap2M accounting.
  2016-01-07  0:11 ` Dave Jones
@ 2016-01-07  0:18   ` Dave Jones
  2016-01-11  8:58     ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Jones @ 2016-01-07  0:18 UTC (permalink / raw)
  To: Linux Kernel, x86

On Wed, Jan 06, 2016 at 07:11:41PM -0500, Dave Jones wrote:
 > On Wed, Jan 06, 2016 at 06:55:27PM -0500, Dave Jones wrote:
 >  > 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 ?

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: weird DirectMap2M accounting.
  2016-01-07  0:18   ` Dave Jones
@ 2016-01-11  8:58     ` Thomas Gleixner
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2016-01-11  8:58 UTC (permalink / raw)
  To: Dave Jones; +Cc: Linux Kernel, x86

On Wed, 6 Jan 2016, Dave Jones wrote:
> On Wed, Jan 06, 2016 at 07:11:41PM -0500, Dave Jones wrote:
>  > On Wed, Jan 06, 2016 at 06:55:27PM -0500, Dave Jones wrote:
>  >  > 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 ?
> 
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-11  8:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-06 23:55 weird DirectMap2M accounting Dave Jones
2016-01-07  0:11 ` Dave Jones
2016-01-07  0:18   ` Dave Jones
2016-01-11  8:58     ` Thomas Gleixner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.