Skip to contentSkip to conversation

ARM: print cma-reserved pages from show_mem

PATCH In review Gregory Fong 5 participants 21 messages Feb 4, 2015 – Apr 13, 2015 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: print cma-reserved pages from show_mem

Add cma reserved information to the ARM-specific show_mem. It was added to the generic implementation by commit 49abd8c28046adf77c5ce1949549aa64d7221881 "lib/show_mem.c: add cma reserved information".

---
 arch/arm/mm/init.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/mm/init.c +4 -0
index 2495c8c..da77507 100644
@@ -22,6 +22,7 @@
 #include <linux/memblock.h>
 #include <linux/dma-contiguous.h>
 #include <linux/sizes.h>
+#include <linux/cma.h>
 
 #include <asm/cp15.h>
 #include <asm/mach-types.h>
@@ -130,6 +131,9 @@ void show_mem(unsigned int filter)
 	printk("%d pages of RAM\n", total);
 	printk("%d free pages\n", free);
 	printk("%d reserved pages\n", reserved);
+#ifdef CONFIG_CMA
+	printk("%lu cma reserved pages\n", totalcma_pages);
+#endif
 	printk("%d slab pages\n", slab);
 	printk("%d pages shared\n", shared);
 	printk("%d pages swap cached\n", cached);
Signature · 1 line
1.9.1
#1 lore raw
Quoted 23 lines · Gregory Fong

Add cma reserved information to the ARM-specific show_mem. It was added to the generic implementation by commit 49abd8c28046adf77c5ce1949549aa64d7221881 "lib/show_mem.c: add cma reserved information".

---
  arch/arm/mm/init.c | 4 ++++
  1 file changed, 4 insertions(+)
arch/arm/mm/init.c +1 -0
index 2495c8c..da77507 100644
@@ -22,6 +22,7 @@
  #include <linux/memblock.h>
  #include <linux/dma-contiguous.h>
  #include <linux/sizes.h>
+#include <linux/cma.h>
 
  #include <asm/cp15.h>
  #include <asm/mach-types.h>

arch/arm/mm/init.c void show_mem(unsigned int filter) · line 136

Quoted 6 lines
arch/arm/mm/init.c +3 -0
@@ -130,6 +131,9 @@ void show_mem(unsigned int filter)
  	printk("%d pages of RAM\n", total);
  	printk("%d free pages\n", free);
  	printk("%d reserved pages\n", reserved);
+#ifdef CONFIG_CMA
+	printk("%lu cma reserved pages\n", totalcma_pages);
+#endif

Nit: 'cma reserved pages' is a bit unclear. Are there some CMA pages that aren't reserved? Dropping the reserved might be clearer.

Thanks,
Laura

Signature · 3 lines
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw
Quoted 22 lines · Laura Abbott
Quoted 21 lines · Gregory Fong

Add cma reserved information to the ARM-specific show_mem. It was added to the generic implementation by commit 49abd8c28046adf77c5ce1949549aa64d7221881 "lib/show_mem.c: add cma reserved information".

---
  arch/arm/mm/init.c | 4 ++++
  1 file changed, 4 insertions(+)
arch/arm/mm/init.c +1 -0
index 2495c8c..da77507 100644
@@ -22,6 +22,7 @@
  #include <linux/memblock.h>
  #include <linux/dma-contiguous.h>
  #include <linux/sizes.h>
+#include <linux/cma.h>
 
Quoted 14 lines

arch/arm/mm/init.c void show_mem(unsigned int filter) · line 136

Quoted 9 lines
arch/arm/mm/init.c +3 -0
  #include <asm/cp15.h>
  #include <asm/mach-types.h>
@@ -130,6 +131,9 @@ void show_mem(unsigned int filter)
        printk("%d pages of RAM\n", total);
        printk("%d free pages\n", free);
        printk("%d reserved pages\n", reserved);
+#ifdef CONFIG_CMA
+       printk("%lu cma reserved pages\n", totalcma_pages);
+#endif

Nit: 'cma reserved pages' is a bit unclear. Are there some CMA pages that aren't reserved? Dropping the reserved might be clearer.

Sure, I was trying to replicate what's in lib/show_mem.c, but it doesn't actually make much sense. Maybe it would be better to change to "cma pages" here and change the wording in that lib/show_mem.c too.

I'll wait a bit for any other thoughts and send out a v2 with those changes.

Thanks,
Gregory

#3 lore raw
Quoted 38 lines · Gregory Fong
Quoted 22 lines · Laura Abbott
Quoted 21 lines · Gregory Fong

Add cma reserved information to the ARM-specific show_mem. It was added to the generic implementation by commit 49abd8c28046adf77c5ce1949549aa64d7221881 "lib/show_mem.c: add cma reserved information".

---
   arch/arm/mm/init.c | 4 ++++
   1 file changed, 4 insertions(+)
arch/arm/mm/init.c +1 -0
index 2495c8c..da77507 100644
@@ -22,6 +22,7 @@
   #include <linux/memblock.h>
   #include <linux/dma-contiguous.h>
   #include <linux/sizes.h>
+#include <linux/cma.h>
 
Quoted 14 lines

arch/arm/mm/init.c void show_mem(unsigned int filter) · line 136

Quoted 9 lines
arch/arm/mm/init.c +3 -0
   #include <asm/cp15.h>
   #include <asm/mach-types.h>
@@ -130,6 +131,9 @@ void show_mem(unsigned int filter)
         printk("%d pages of RAM\n", total);
         printk("%d free pages\n", free);
         printk("%d reserved pages\n", reserved);
+#ifdef CONFIG_CMA
+       printk("%lu cma reserved pages\n", totalcma_pages);
+#endif

Nit: 'cma reserved pages' is a bit unclear. Are there some CMA pages that aren't reserved? Dropping the reserved might be clearer.

Quoted 6 lines

Sure, I was trying to replicate what's in lib/show_mem.c, but it doesn't actually make much sense. Maybe it would be better to change to "cma pages" here and change the wording in that lib/show_mem.c too.

I'll wait a bit for any other thoughts and send out a v2 with those changes.

So it looks like the lib/show_mem.c does something different

#ifdef CONFIG_CMA
         printk("%lu pages reserved\n", (reserved - totalcma_pages));
         printk("%lu pages cma reserved\n", totalcma_pages);
#else
         printk("%lu pages reserved\n", reserved);

#endif

No need to change the name, instead I'd say fix up arm to match what the generic showmem is doing.

Thanks,
Laura

Signature · 3 lines
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#4 lore raw
Quoted 59 lines · Laura Abbott
Quoted 44 lines · Gregory Fong
Quoted 24 lines · Laura Abbott
Quoted 22 lines · Gregory Fong

Add cma reserved information to the ARM-specific show_mem. It was added to the generic implementation by commit 49abd8c28046adf77c5ce1949549aa64d7221881 "lib/show_mem.c: add cma reserved information".

---
   arch/arm/mm/init.c | 4 ++++
   1 file changed, 4 insertions(+)
arch/arm/mm/init.c +1 -0
index 2495c8c..da77507 100644
@@ -22,6 +22,7 @@
   #include <linux/memblock.h>
   #include <linux/dma-contiguous.h>
   #include <linux/sizes.h>
+#include <linux/cma.h>
 
Quoted 15 lines

arch/arm/mm/init.c void show_mem(unsigned int filter) · line 136

Quoted 9 lines
arch/arm/mm/init.c +3 -0
   #include <asm/cp15.h>
   #include <asm/mach-types.h>
@@ -130,6 +131,9 @@ void show_mem(unsigned int filter)
         printk("%d pages of RAM\n", total);
         printk("%d free pages\n", free);
         printk("%d reserved pages\n", reserved);
+#ifdef CONFIG_CMA
+       printk("%lu cma reserved pages\n", totalcma_pages);
+#endif

Nit: 'cma reserved pages' is a bit unclear. Are there some CMA pages that aren't reserved? Dropping the reserved might be clearer.

Quoted 7 lines

Sure, I was trying to replicate what's in lib/show_mem.c, but it doesn't actually make much sense. Maybe it would be better to change to "cma pages" here and change the wording in that lib/show_mem.c too.

I'll wait a bit for any other thoughts and send out a v2 with those changes.

So it looks like the lib/show_mem.c does something different

#ifdef CONFIG_CMA
        printk("%lu pages reserved\n", (reserved - totalcma_pages));
        printk("%lu pages cma reserved\n", totalcma_pages);
#else
        printk("%lu pages reserved\n", reserved);
Quoted 5 lines

#endif

No need to change the name, instead I'd say fix up arm to match what the generic showmem is doing.

The trouble is that lib/show_mem.c and ARM's show_mem use the 'reserved' variable to hold different info, which was not a problem I was aiming to tackle here, and am not sure I understand what's going on well enough to do so. But let's give it a shot:

In lib/show_mem.c, reserved is calculated by iterating over all online nodes, then increasing reserved by (zone->present_pages - zone->managed_pages). This count includes CMA pages and so when reserved pages is printed it should be 'reserved' - totalcma_pages, as it currently is.

In ARM's show_mem, reserved is counted by iterating over memblocks, and within each one iterating over pfns, checking each page to see if it's reserved, and increasing the counter accordingly. Unlike the generic one, this results in counting reserved pages differently than CMA pages.

Unfortunately, I don't see a good way to do the calculation different in the generic implementation that doesn't also count CMA pages in 'reserved'---unless I'm missing something, this isn't available at the zone info level.

If this is correct, then I think the correct set of steps is still what I was suggesting:

1. change generic implementation to say 'cma' rather than 'cma reserved'
2. do what I did in this patch except also remove the word 'reserved' like in (1).

Does that seem sensible?

Thanks,
Gregory

#5 lore raw
Quoted 18 lines · Gregory Fong
Quoted 11 lines · Laura Abbott

So it looks like the lib/show_mem.c does something different

#ifdef CONFIG_CMA
        printk("%lu pages reserved\n", (reserved - totalcma_pages));
        printk("%lu pages cma reserved\n", totalcma_pages);
#else
        printk("%lu pages reserved\n", reserved);

#endif

No need to change the name, instead I'd say fix up arm to match what the generic showmem is doing.

The trouble is that lib/show_mem.c and ARM's show_mem use the 'reserved' variable to hold different info, which was not a problem I was aiming to tackle here, and am not sure I understand what's going on well enough to do so. But let's give it a shot:

Quoted 5 lines

In lib/show_mem.c, reserved is calculated by iterating over all online nodes, then increasing reserved by (zone->present_pages - zone->managed_pages). This count includes CMA pages and so when reserved pages is printed it should be 'reserved' - totalcma_pages, as it currently is.

So, some digging is needed into why the generic version is different. You have to remember that many of the algorithms for this kind of thing were based on the x86 implementation, so differences like this are probably down to ARM being annoyingly overlooked or ignored when generic changes happen.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#6 lore raw

Hello,

Quoted 25 lines · Russell King - ARM Linux
Quoted 18 lines · Gregory Fong
Quoted 11 lines · Laura Abbott

So it looks like the lib/show_mem.c does something different

#ifdef CONFIG_CMA
        printk("%lu pages reserved\n", (reserved - totalcma_pages));
        printk("%lu pages cma reserved\n", totalcma_pages);
#else
        printk("%lu pages reserved\n", reserved);

#endif

No need to change the name, instead I'd say fix up arm to match what the generic showmem is doing.

The trouble is that lib/show_mem.c and ARM's show_mem use the 'reserved' variable to hold different info, which was not a problem I was aiming to tackle here, and am not sure I understand what's going on well enough to do so. But let's give it a shot:

Quoted 5 lines

In lib/show_mem.c, reserved is calculated by iterating over all online nodes, then increasing reserved by (zone->present_pages - zone->managed_pages). This count includes CMA pages and so when reserved pages is printed it should be 'reserved' - totalcma_pages, as it currently is.

Quoted 6 lines

So, some digging is needed into why the generic version is different. You have to remember that many of the algorithms for this kind of thing were based on the x86 implementation, so differences like this are probably down to ARM being annoyingly overlooked or ignored when generic changes happen.

Revisiting this finally, it looks like this was changed by Mel about a year and a half ago in commit c78e93630d15b5f5774213aad9bdc9f52473a89b "mm: do not walk all of system memory during show_mem"[1], which removes the pfn walk and gets this info from struct zone instead, saving a lot of time. Is there any reason to not to change the ARM show_mem to do this as well? With that, I'm not sure I understand why there would need to be an ARM-specific implementation at all anymore, but maybe I'm missing something.

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c78e93630d15b5f5774213aad9bdc9f52473a89b

Best regards,
Gregory

#7 lore raw
Quoted 36 lines · Gregory Fong

Hello,

Quoted 25 lines · Russell King - ARM Linux
Quoted 18 lines · Gregory Fong
Quoted 11 lines · Laura Abbott

So it looks like the lib/show_mem.c does something different

#ifdef CONFIG_CMA
        printk("%lu pages reserved\n", (reserved - totalcma_pages));
        printk("%lu pages cma reserved\n", totalcma_pages);
#else
        printk("%lu pages reserved\n", reserved);

#endif

No need to change the name, instead I'd say fix up arm to match what the generic showmem is doing.

The trouble is that lib/show_mem.c and ARM's show_mem use the 'reserved' variable to hold different info, which was not a problem I was aiming to tackle here, and am not sure I understand what's going on well enough to do so. But let's give it a shot:

Quoted 5 lines

In lib/show_mem.c, reserved is calculated by iterating over all online nodes, then increasing reserved by (zone->present_pages - zone->managed_pages). This count includes CMA pages and so when reserved pages is printed it should be 'reserved' - totalcma_pages, as it currently is.

Quoted 6 lines

So, some digging is needed into why the generic version is different. You have to remember that many of the algorithms for this kind of thing were based on the x86 implementation, so differences like this are probably down to ARM being annoyingly overlooked or ignored when generic changes happen.

Quoted 6 lines

Revisiting this finally, it looks like this was changed by Mel about a year and a half ago in commit c78e93630d15b5f5774213aad9bdc9f52473a89b "mm: do not walk all of system memory during show_mem"[1], which removes the pfn walk and gets this info from struct zone instead, saving a lot of time. Is there any reason to not to change the ARM show_mem to do this as well?

I did not read through this thread and only see this mail but AFAIK, the same change should be safe on ARM. I simply had no means of testing ARM changes and the problem only affected large machines. For all I knew, ARM developers really cared about the accuracy of this information so I played it safe.

Signature · 2 lines
Mel Gorman
SUSE Labs
#8 lore raw
In reply to Gregory Fong
Quoted 36 lines · Gregory Fong

Hello,

Quoted 25 lines · Russell King - ARM Linux
Quoted 18 lines · Gregory Fong
Quoted 11 lines · Laura Abbott

So it looks like the lib/show_mem.c does something different

#ifdef CONFIG_CMA
        printk("%lu pages reserved\n", (reserved - totalcma_pages));
        printk("%lu pages cma reserved\n", totalcma_pages);
#else
        printk("%lu pages reserved\n", reserved);

#endif

No need to change the name, instead I'd say fix up arm to match what the generic showmem is doing.

The trouble is that lib/show_mem.c and ARM's show_mem use the 'reserved' variable to hold different info, which was not a problem I was aiming to tackle here, and am not sure I understand what's going on well enough to do so. But let's give it a shot:

Quoted 5 lines

In lib/show_mem.c, reserved is calculated by iterating over all online nodes, then increasing reserved by (zone->present_pages - zone->managed_pages). This count includes CMA pages and so when reserved pages is printed it should be 'reserved' - totalcma_pages, as it currently is.

Quoted 6 lines

So, some digging is needed into why the generic version is different. You have to remember that many of the algorithms for this kind of thing were based on the x86 implementation, so differences like this are probably down to ARM being annoyingly overlooked or ignored when generic changes happen.

Quoted 8 lines

Revisiting this finally, it looks like this was changed by Mel about a year and a half ago in commit c78e93630d15b5f5774213aad9bdc9f52473a89b "mm: do not walk all of system memory during show_mem"[1], which removes the pfn walk and gets this info from struct zone instead, saving a lot of time. Is there any reason to not to change the ARM show_mem to do this as well? With that, I'm not sure I understand why there would need to be an ARM-specific implementation at all anymore, but maybe I'm missing something.

Looking at Mel's commit, I don't see a reason why we couldn't use that solution - it gets rid of walking the page array, which has been fraught in the past due to ARM having platforms which have holes in their physical memory.

We could try that solution - I don't see much downside to it. Most of that information is as debug information for MM stuff anyway, and IMHO it doesn't make much sense for it to be different between architectures.

Maybe we should just switch to using the generic version?

8<===
From: Russell King <[email protected]>
Subject: [PATCH] ARM: switch to use the generic show_mem() implementation

Switch ARM to use the generic show_mem() implementation, which displays the statistics from the mm zone rather than walking the page arrays.

---
 arch/arm/mm/init.c | 49 -------------------------------------------------
 1 file changed, 49 deletions(-)
arch/arm/mm/init.c +0 -49
index 1609b022a72f..ae369c1066e6 100644
@@ -86,55 +86,6 @@ static int __init parse_tag_initrd2(const struct tag *tag)
 
 __tagtable(ATAG_INITRD2, parse_tag_initrd2);
 
-/*
- * This keeps memory configuration data used by a couple memory
- * initialization functions, as well as show_mem() for the skipping
- * of holes in the memory map.  It is populated by arm_add_memory().
- */
-void show_mem(unsigned int filter)
-{
-	int free = 0, total = 0, reserved = 0;
-	int shared = 0, cached = 0, slab = 0;
-	struct memblock_region *reg;
-
-	printk("Mem-info:\n");
-	show_free_areas(filter);
-
-	for_each_memblock (memory, reg) {
-		unsigned int pfn1, pfn2;
-		struct page *page, *end;
-
-		pfn1 = memblock_region_memory_base_pfn(reg);
-		pfn2 = memblock_region_memory_end_pfn(reg);
-
-		page = pfn_to_page(pfn1);
-		end  = pfn_to_page(pfn2 - 1) + 1;
-
-		do {
-			total++;
-			if (PageReserved(page))
-				reserved++;
-			else if (PageSwapCache(page))
-				cached++;
-			else if (PageSlab(page))
-				slab++;
-			else if (!page_count(page))
-				free++;
-			else
-				shared += page_count(page) - 1;
-			pfn1++;
-			page = pfn_to_page(pfn1);
-		} while (pfn1 < pfn2);
-	}
-
-	printk("%d pages of RAM\n", total);
-	printk("%d free pages\n", free);
-	printk("%d reserved pages\n", reserved);
-	printk("%d slab pages\n", slab);
-	printk("%d pages shared\n", shared);
-	printk("%d pages swap cached\n", cached);
-}
-
 static void __init find_limits(unsigned long *min, unsigned long *max_low,
 			       unsigned long *max_high)
 {
Signature · 7 lines
1.8.3.1



-- 
FTTC broadband for 0.8mile line: [email protected] down 400kbps up
according to speedtest.net.
Acked-by
#9 lore raw
Quoted 11 lines · Russell King - ARM Linux

<SNIP>

Looking at Mel's commit, I don't see a reason why we couldn't use that solution - it gets rid of walking the page array, which has been fraught in the past due to ARM having platforms which have holes in their physical memory.

We could try that solution - I don't see much downside to it. Most of that information is as debug information for MM stuff anyway, and IMHO

From an MM perspective, I can tell you that the information is close to

useless for debugging anything. It's why I ditched it in that commit and AFAIK, no one has ever cared.

Quoted 8 lines

8<===
From: Russell King <[email protected]>
Subject: [PATCH] ARM: switch to use the generic show_mem() implementation

Switch ARM to use the generic show_mem() implementation, which displays the statistics from the mm zone rather than walking the page arrays.

If this builds, boots and sysrq-m works as expected then for what it's worth

Acked-by Mel Gorman <mgorman <[email protected]>
Signature · 2 lines
Mel Gorman
SUSE Labs
#10 lore raw
Quoted 8 lines · Mel Gorman
Quoted 7 lines · Russell King - ARM Linux

<SNIP>

Looking at Mel's commit, I don't see a reason why we couldn't use that solution - it gets rid of walking the page array, which has been fraught in the past due to ARM having platforms which have holes in their physical memory.

Quoted 6 lines
Quoted 4 lines

We could try that solution - I don't see much downside to it. Most of that information is as debug information for MM stuff anyway, and IMHO

From an MM perspective, I can tell you that the information is close to

useless for debugging anything. It's why I ditched it in that commit and AFAIK, no one has ever cared.

In that case, is there much point to show_mem()? Is it something which should be considered for removal?

If code serves no useful purpose anymore, we really ought to have a way to remove it.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#11 lore raw
Quoted 12 lines · Russell King - ARM Linux
Quoted 11 lines · Mel Gorman
Quoted 9 lines · Russell King - ARM Linux

<SNIP>

Looking at Mel's commit, I don't see a reason why we couldn't use that solution - it gets rid of walking the page array, which has been fraught in the past due to ARM having platforms which have holes in their physical memory.

We could try that solution - I don't see much downside to it. Most of that information is as debug information for MM stuff anyway, and IMHO

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

From an MM perspective, I can tell you that the information is close to

useless for debugging anything. It's why I ditched it in that commit and AFAIK, no one has ever cared.

In that case, is there much point to show_mem()? Is it something which should be considered for removal?

If code serves no useful purpose anymore, we really ought to have a way

Sorry I was not clear. show_mem itself is useful, the shared and non-shared values that commit c78e93630d15b5f5774213aad9bdc9f52473a89b removed are not.

Signature · 2 lines
Mel Gorman
SUSE Labs
author Tested-by
#12 lore raw
In reply to Mel Gorman
Quoted 19 lines · Mel Gorman
Quoted 9 lines · Russell King - ARM Linux

<SNIP>

Looking at Mel's commit, I don't see a reason why we couldn't use that solution - it gets rid of walking the page array, which has been fraught in the past due to ARM having platforms which have holes in their physical memory.

We could try that solution - I don't see much downside to it. Most of that information is as debug information for MM stuff anyway, and IMHO

From an MM perspective, I can tell you that the information is close to useless for debugging anything. It's why I ditched it in that commit and AFAIK, no one has ever cared.

Quoted 4 lines

8<===
From: Russell King <[email protected]>
Subject: [PATCH] ARM: switch to use the generic show_mem() implementation

Quoted 8 lines
Quoted 4 lines

Switch ARM to use the generic show_mem() implementation, which displays the statistics from the mm zone rather than walking the page arrays.

If this builds, boots and sysrq-m works as expected then for what it's worth

Acked-by Mel Gorman <mgorman <[email protected]>

Tried applying this change and the equivalent for 3.14. Comparing before/after on a brcmstb platform, all of the numbers still look right when I run sysrq-m.

Before:

[   12.191615] SysRq : Show Memory
[   12.194789] Mem-info:
[   12.197069] DMA per-cpu:
[   12.199611] CPU    0: hi:  186, btch:  31 usd: 113
[   12.204409] HighMem per-cpu:
[   12.207295] CPU    0: hi:   90, btch:  15 usd:  44
[   12.212102] active_anon:734 inactive_anon:1189 isolated_anon:0
[   12.212102]  active_file:0 inactive_file:0 isolated_file:0
[   12.212102]  unevictable:0 dirty:0 writeback:0 unstable:0
[   12.212102]  free:254104 slab_reclaimable:82 slab_unreclaimable:843
[   12.212102]  mapped:429 shmem:1815 pagetables:13 bounce:0
[   12.212102]  free_cma:4032
[   12.243172] DMA free:754080kB min:3472kB low:4340kB high:5208kB

active_anon:180kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:778240kB managed:759252kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:328kB slab_unreclaimable:3372kB kernel_stack:240kB pagetables:12kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes

[   12.283257] lowmem_reserve[]: 0 0 264 264
[   12.287349] HighMem free:262336kB min:264kB low:572kB high:884kB

active_anon:2756kB inactive_anon:4756kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:270336kB managed:270336kB mlocked:0kB dirty:0kB writeback:0kB mapped:1716kB shmem:7260kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:40kB unstable:0kB bounce:0kB free_cma:16128kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes

[   12.328129] lowmem_reserve[]: 0 0 0 0
[   12.331859] DMA: 6*4kB (M) 11*8kB (UEM) 7*16kB (UEM) 6*32kB (UM)
4*64kB (UM) 6*128kB (UEM) 2*256kB (M) 3*512kB (UEM) 5*1024kB (UEM)
6*2048kB (UEM) 3*4096kB (EM) 88*8192kB (MR) = 754080kB
[   12.348817] HighMem: 2*4kB (UM) 1*8kB (M) 1*16kB (M) 1*32kB (M)
0*64kB 1*128kB (U) 2*256kB (UC) 3*512kB (UMC) 2*1024kB (UC) 2*2048kB
(UC) 2*4096kB (UC) 30*8192kB (MRC) = 262336kB
[   12.365058] 1815 total pagecache pages
[   12.368816] 0 pages in swap cache
[   12.372136] Swap cache stats: add 0, delete 0, find 0/0
[   12.377366] Free swap  = 0kB
[   12.380251] Total swap = 0kB
[   12.392342] 262144 pages of RAM
[   12.395494] 254306 free pages
[   12.398464] 4747 reserved pages
[   12.401609] 834 slab pages
[   12.404319] 1069 pages shared
[   12.407290] 0 pages swap cache

After:

[    3.743999] SysRq : Show Memory
[    3.747171] Mem-Info:
[    3.749451] DMA per-cpu:
[    3.751991] CPU    0: hi:  186, btch:  31 usd: 102
[    3.756790] HighMem per-cpu:
[    3.759678] CPU    0: hi:   90, btch:  15 usd:  27
[    3.764486] active_anon:724 inactive_anon:1189 isolated_anon:0
[    3.764486]  active_file:0 inactive_file:0 isolated_file:0
[    3.764486]  unevictable:0 dirty:0 writeback:0 unstable:0
[    3.764486]  free:254134 slab_reclaimable:81 slab_unreclaimable:842
[    3.764486]  mapped:429 shmem:1815 pagetables:13 bounce:0
[    3.764486]  free_cma:4032
[    3.795556] DMA free:754080kB min:3472kB low:4340kB high:5208kB

active_anon:208kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:778240kB managed:759252kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:324kB slab_unreclaimable:3368kB kernel_stack:240kB pagetables:36kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes

[    3.835641] lowmem_reserve[]: 0 0 264 264
[    3.839734] HighMem free:262456kB min:264kB low:572kB high:884kB

active_anon:2688kB inactive_anon:4756kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:270336kB managed:270336kB mlocked:0kB dirty:0kB writeback:0kB mapped:1716kB shmem:7260kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:16kB unstable:0kB bounce:0kB free_cma:16128kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes

[    3.880512] lowmem_reserve[]: 0 0 0 0
[    3.884244] DMA: 6*4kB (M) 11*8kB (UEM) 7*16kB (UEM) 6*32kB (UM)
4*64kB (UM) 6*128kB (UEM) 2*256kB (M) 3*512kB (UEM) 5*1024kB (UEM)
6*2048kB (UEM) 3*4096kB (EM) 88*8192kB (MR) = 754080kB
[    3.901199] HighMem: 0*4kB 1*8kB (M) 1*16kB (M) 1*32kB (M) 2*64kB
(UM) 1*128kB (U) 2*256kB (UC) 3*512kB (UMC) 2*1024kB (UC) 2*2048kB
(UC) 2*4096kB (UC) 30*8192kB (MRC) = 262456kB
[    3.917441] 1815 total pagecache pages
[    3.921198] 0 pages in swap cache
[    3.924518] Swap cache stats: add 0, delete 0, find 0/0
[    3.929748] Free swap  = 0kB
[    3.932632] Total swap = 0kB
[    3.935516] 262144 pages RAM
[    3.938401] 67584 pages HighMem/MovableOnly
[    3.942588] 651 pages reserved
[    3.945646] 4096 pages cma reserved
#13 lore raw
Quoted 126 lines

-----Original Message-----
From: Gregory Fong [mailto:gregory.0xf0 at gmail.com]
Sent: Friday, April 10, 2015 12:36 PM
To: Mel Gorman
Cc: Russell King - ARM Linux; Laura Abbott; Florian Fainelli; Kees Cook; Nicolas Pitre; Catalin Marinas; open list; Wang, Yalin; linux-arm- kernel at lists.infradead.org; vishnu.ps at samsung.com; Marek Szyprowski; Johannes Weiner
Subject: Re: [PATCH] ARM: print cma-reserved pages from show_mem

Quoted 8 lines · Mel Gorman
Quoted 7 lines · Russell King - ARM Linux

<SNIP>

Looking at Mel's commit, I don't see a reason why we couldn't use that solution - it gets rid of walking the page array, which has been fraught in the past due to ARM having platforms which have holes in their physical memory.

Quoted 10 lines
Quoted 2 lines

We could try that solution - I don't see much downside to it. Most of that information is as debug information for MM stuff anyway, and IMHO

From an MM perspective, I can tell you that the information is close to useless for debugging anything. It's why I ditched it in that commit and AFAIK, no one has ever cared.

Quoted 3 lines

8<===
From: Russell King <[email protected]>
Subject: [PATCH] ARM: switch to use the generic show_mem()

implementation

Quoted 7 lines
Quoted 5 lines

Switch ARM to use the generic show_mem() implementation, which displays the statistics from the mm zone rather than walking the page arrays.

If this builds, boots and sysrq-m works as expected then for what it's

worth

Quoted 2 lines
Acked-by Mel Gorman <mgorman <[email protected]>

Tried applying this change and the equivalent for 3.14. Comparing before/after on a brcmstb platform, all of the numbers still look right when I run sysrq-m.

Before:

[   12.191615] SysRq : Show Memory
[   12.194789] Mem-info:
[   12.197069] DMA per-cpu:
[   12.199611] CPU    0: hi:  186, btch:  31 usd: 113
[   12.204409] HighMem per-cpu:
[   12.207295] CPU    0: hi:   90, btch:  15 usd:  44
[   12.212102] active_anon:734 inactive_anon:1189 isolated_anon:0
[   12.212102]  active_file:0 inactive_file:0 isolated_file:0
[   12.212102]  unevictable:0 dirty:0 writeback:0 unstable:0
[   12.212102]  free:254104 slab_reclaimable:82 slab_unreclaimable:843
[   12.212102]  mapped:429 shmem:1815 pagetables:13 bounce:0
[   12.212102]  free_cma:4032
[   12.243172] DMA free:754080kB min:3472kB low:4340kB high:5208kB

active_anon:180kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:778240kB managed:759252kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:328kB slab_unreclaimable:3372kB kernel_stack:240kB pagetables:12kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes

[   12.283257] lowmem_reserve[]: 0 0 264 264
[   12.287349] HighMem free:262336kB min:264kB low:572kB high:884kB

active_anon:2756kB inactive_anon:4756kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:270336kB managed:270336kB mlocked:0kB dirty:0kB writeback:0kB mapped:1716kB shmem:7260kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:40kB unstable:0kB bounce:0kB free_cma:16128kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes

[   12.328129] lowmem_reserve[]: 0 0 0 0
[   12.331859] DMA: 6*4kB (M) 11*8kB (UEM) 7*16kB (UEM) 6*32kB (UM)
4*64kB (UM) 6*128kB (UEM) 2*256kB (M) 3*512kB (UEM) 5*1024kB (UEM)
6*2048kB (UEM) 3*4096kB (EM) 88*8192kB (MR) = 754080kB
[   12.348817] HighMem: 2*4kB (UM) 1*8kB (M) 1*16kB (M) 1*32kB (M)
0*64kB 1*128kB (U) 2*256kB (UC) 3*512kB (UMC) 2*1024kB (UC) 2*2048kB
(UC) 2*4096kB (UC) 30*8192kB (MRC) = 262336kB
[   12.365058] 1815 total pagecache pages
[   12.368816] 0 pages in swap cache
[   12.372136] Swap cache stats: add 0, delete 0, find 0/0
[   12.377366] Free swap  = 0kB
[   12.380251] Total swap = 0kB
[   12.392342] 262144 pages of RAM
[   12.395494] 254306 free pages
[   12.398464] 4747 reserved pages
[   12.401609] 834 slab pages
[   12.404319] 1069 pages shared
[   12.407290] 0 pages swap cache

After:

[    3.743999] SysRq : Show Memory
[    3.747171] Mem-Info:
[    3.749451] DMA per-cpu:
[    3.751991] CPU    0: hi:  186, btch:  31 usd: 102
[    3.756790] HighMem per-cpu:
[    3.759678] CPU    0: hi:   90, btch:  15 usd:  27
[    3.764486] active_anon:724 inactive_anon:1189 isolated_anon:0
[    3.764486]  active_file:0 inactive_file:0 isolated_file:0
[    3.764486]  unevictable:0 dirty:0 writeback:0 unstable:0
[    3.764486]  free:254134 slab_reclaimable:81 slab_unreclaimable:842
[    3.764486]  mapped:429 shmem:1815 pagetables:13 bounce:0
[    3.764486]  free_cma:4032
[    3.795556] DMA free:754080kB min:3472kB low:4340kB high:5208kB

active_anon:208kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:778240kB managed:759252kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:324kB slab_unreclaimable:3368kB kernel_stack:240kB pagetables:36kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes

[    3.835641] lowmem_reserve[]: 0 0 264 264
[    3.839734] HighMem free:262456kB min:264kB low:572kB high:884kB

active_anon:2688kB inactive_anon:4756kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:270336kB managed:270336kB mlocked:0kB dirty:0kB writeback:0kB mapped:1716kB shmem:7260kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:16kB unstable:0kB bounce:0kB free_cma:16128kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes

Quoted 16 lines
[    3.880512] lowmem_reserve[]: 0 0 0 0
[    3.884244] DMA: 6*4kB (M) 11*8kB (UEM) 7*16kB (UEM) 6*32kB (UM)
4*64kB (UM) 6*128kB (UEM) 2*256kB (M) 3*512kB (UEM) 5*1024kB (UEM)
6*2048kB (UEM) 3*4096kB (EM) 88*8192kB (MR) = 754080kB
[    3.901199] HighMem: 0*4kB 1*8kB (M) 1*16kB (M) 1*32kB (M) 2*64kB
(UM) 1*128kB (U) 2*256kB (UC) 3*512kB (UMC) 2*1024kB (UC) 2*2048kB
(UC) 2*4096kB (UC) 30*8192kB (MRC) = 262456kB
[    3.917441] 1815 total pagecache pages
[    3.921198] 0 pages in swap cache
[    3.924518] Swap cache stats: add 0, delete 0, find 0/0
[    3.929748] Free swap  = 0kB
[    3.932632] Total swap = 0kB
[    3.935516] 262144 pages RAM
[    3.938401] 67584 pages HighMem/MovableOnly
[    3.942588] 651 pages reserved
[    3.945646] 4096 pages cma reserved

Could we also add "834 slab pages" item into generic show_mem( ) Function? It is useful, and is it equal to slab_reclaimable + slab_unreclaimable ? If yes, I think we can add it just like what ARM does.

Thanks

#14 lore raw
Quoted 4 lines · Yalin
Quoted 4 lines
[   12.212102] active_anon:734 inactive_anon:1189 isolated_anon:0
[   12.212102]  active_file:0 inactive_file:0 isolated_file:0
[   12.212102]  unevictable:0 dirty:0 writeback:0 unstable:0
[   12.212102]  free:254104 slab_reclaimable:82 slab_unreclaimable:843

Here, we have 82 pages reclaimable, which is 328kB, and 843 unreclaimable which is 3372kB, which is a total of 925 pages.

Quoted 7 lines
Quoted 7 lines
[   12.212102]  mapped:429 shmem:1815 pagetables:13 bounce:0
[   12.212102]  free_cma:4032
[   12.243172] DMA free:754080kB min:3472kB low:4340kB high:5208kB

active_anon:180kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:778240kB managed:759252kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:328kB slab_unreclaimable:3372kB

Which agrees here.

Quoted 1 line
Quoted 1 line
[   12.401609] 834 slab pages

but not here... this is an interesting difference, because in the ARM version of show_mem(), we count the actual number of pages where PageSlab() returns true. Can slab pages also be reserved pages or swap cache pages? I thought they were exclusive of those. So, the question comes... why the difference in accounting, and which one is correct.

Maybe there's a bug in the accounting somewhere...

So I think we're not ready for this patch to be merged yet.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#15 lore raw
Quoted 21 lines · Russell King - ARM Linux
Quoted 4 lines · Yalin
Quoted 4 lines
[   12.212102] active_anon:734 inactive_anon:1189 isolated_anon:0
[   12.212102]  active_file:0 inactive_file:0 isolated_file:0
[   12.212102]  unevictable:0 dirty:0 writeback:0 unstable:0
[   12.212102]  free:254104 slab_reclaimable:82 slab_unreclaimable:843

Here, we have 82 pages reclaimable, which is 328kB, and 843 unreclaimable which is 3372kB, which is a total of 925 pages.

Quoted 7 lines
Quoted 7 lines
[   12.212102]  mapped:429 shmem:1815 pagetables:13 bounce:0
[   12.212102]  free_cma:4032
[   12.243172] DMA free:754080kB min:3472kB low:4340kB high:5208kB

active_anon:180kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:778240kB managed:759252kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:328kB slab_unreclaimable:3372kB

Which agrees here.

Quoted 1 line
Quoted 1 line
[   12.401609] 834 slab pages
Quoted 8 lines

but not here... this is an interesting difference, because in the ARM version of show_mem(), we count the actual number of pages where PageSlab() returns true. Can slab pages also be reserved pages or swap cache pages? I thought they were exclusive of those. So, the question comes... why the difference in accounting, and which one is correct.

Maybe there's a bug in the accounting somewhere...

Yes, the ARM show_mem wasn't updated after the various allocators (SLUB, SLAB, SLOB) were updated to use compound pages. Fixing it, you get

[    7.081826] sysrq: SysRq : Show Memory
[    7.085610] Mem-info:
[    7.087890] DMA per-cpu:
[    7.090431] CPU    0: hi:  186, btch:  31 usd:  98
[    7.095230] HighMem per-cpu:
[    7.098116] CPU    0: hi:   90, btch:  15 usd:  29
[    7.102923] active_anon:724 inactive_anon:1189 isolated_anon:0
[    7.102923]  active_file:0 inactive_file:0 isolated_file:0
[    7.102923]  unevictable:0 dirty:0 writeback:0 unstable:0
[    7.102923]  free:253980 slab_reclaimable:83 slab_unreclaimable:846
[    7.102923]  mapped:429 shmem:1815 pagetables:15 bounce:0
[    7.102923]  free_cma:4032
[    7.133995] DMA free:753344kB min:3472kB low:4340kB high:5208kB active_anon:292kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:778240kB managed:759188kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:332kB slab_unreclaimable:3384kB kernel_stack:256kB pagetables:36kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes
[    7.174080] lowmem_reserve[]: 0 0 264 264
[    7.178175] HighMem free:262576kB min:264kB low:572kB high:884kB active_anon:2604kB inactive_anon:4756kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:270336kB managed:270336kB mlocked:0kB dirty:0kB writeback:0kB mapped:1716kB shmem:7260kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:24kB unstable:0kB bounce:0kB free_cma:16128kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes
[    7.218955] lowmem_reserve[]: 0 0 0 0
[    7.222687] DMA: 8*4kB (UEM) 8*8kB (UM) 4*16kB (UEM) 5*32kB (UM) 2*64kB (M) 4*128kB (UEM) 3*256kB (M) 2*512kB (EM) 5*1024kB (UEM) 6*2048kB (UEM) 3*4096kB (EM) 88*8192kB (MR) = 753344kB
[    7.239477] HighMem: 0*4kB 0*8kB 1*16kB (M) 1*32kB (M) 2*64kB (UM) 2*128kB (UM) 2*256kB (UC) 3*512kB (UMC) 2*1024kB (UC) 2*2048kB (UC) 2*4096kB (UC) 30*8192kB (MRC) = 262576kB
[    7.255455] 1815 total pagecache pages
[    7.259211] 0 pages in swap cache
[    7.262533] Swap cache stats: add 0, delete 0, find 0/0
[    7.267764] Free swap  = 0kB
[    7.270647] Total swap = 0kB
[    7.282890] 262144 pages of RAM
[    7.286041] 254274 free pages
[    7.289013] 4763 reserved pages
[    7.292157] 929 slab pages
[    7.294868] 1063 pages shared
[    7.297839] 0 pages swap cached

And now we see 83 slab_reclaimable + 846 slab_unreclaimable adds up correctly to the total of 929.

The patch below will end up with the correct count.

8<===

arch/arm/mm/init.c +1 -1
index 1609b02..8d606bb 100644
@@ -117,7 +117,7 @@ void show_mem(unsigned int filter)
                        else if (PageSwapCache(page))
                                cached++;
                        else if (PageSlab(page))
-                               slab++;
+                               slab += 1 << compound_order(page);
                        else if (!page_count(page))
                                free++;
                        else
Signature · 1 line
 Gregory V. Fong >< GPG key: 0BAE9648
#16 lore raw
Quoted 65 lines · Gregory Fong
Quoted 21 lines · Russell King - ARM Linux
Quoted 4 lines · Yalin
Quoted 4 lines
[   12.212102] active_anon:734 inactive_anon:1189 isolated_anon:0
[   12.212102]  active_file:0 inactive_file:0 isolated_file:0
[   12.212102]  unevictable:0 dirty:0 writeback:0 unstable:0
[   12.212102]  free:254104 slab_reclaimable:82 slab_unreclaimable:843

Here, we have 82 pages reclaimable, which is 328kB, and 843 unreclaimable which is 3372kB, which is a total of 925 pages.

Quoted 7 lines
Quoted 7 lines
[   12.212102]  mapped:429 shmem:1815 pagetables:13 bounce:0
[   12.212102]  free_cma:4032
[   12.243172] DMA free:754080kB min:3472kB low:4340kB high:5208kB

active_anon:180kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:778240kB managed:759252kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:328kB slab_unreclaimable:3372kB

Which agrees here.

Quoted 1 line
Quoted 1 line
[   12.401609] 834 slab pages
Quoted 8 lines

but not here... this is an interesting difference, because in the ARM version of show_mem(), we count the actual number of pages where PageSlab() returns true. Can slab pages also be reserved pages or swap cache pages? I thought they were exclusive of those. So, the question comes... why the difference in accounting, and which one is correct.

Maybe there's a bug in the accounting somewhere...

Yes, the ARM show_mem wasn't updated after the various allocators (SLUB, SLAB, SLOB) were updated to use compound pages. Fixing it, you get

[    7.081826] sysrq: SysRq : Show Memory
[    7.085610] Mem-info:
[    7.087890] DMA per-cpu:
[    7.090431] CPU    0: hi:  186, btch:  31 usd:  98
[    7.095230] HighMem per-cpu:
[    7.098116] CPU    0: hi:   90, btch:  15 usd:  29
[    7.102923] active_anon:724 inactive_anon:1189 isolated_anon:0
[    7.102923]  active_file:0 inactive_file:0 isolated_file:0
[    7.102923]  unevictable:0 dirty:0 writeback:0 unstable:0
[    7.102923]  free:253980 slab_reclaimable:83 slab_unreclaimable:846
[    7.102923]  mapped:429 shmem:1815 pagetables:15 bounce:0
[    7.102923]  free_cma:4032
[    7.133995] DMA free:753344kB min:3472kB low:4340kB high:5208kB active_anon:292kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:778240kB managed:759188kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:332kB slab_unreclaimable:3384kB kernel_stack:256kB pagetables:36kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes
[    7.174080] lowmem_reserve[]: 0 0 264 264
[    7.178175] HighMem free:262576kB min:264kB low:572kB high:884kB active_anon:2604kB inactive_anon:4756kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:270336kB managed:270336kB mlocked:0kB dirty:0kB writeback:0kB mapped:1716kB shmem:7260kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:24kB unstable:0kB bounce:0kB free_cma:16128kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes
[    7.218955] lowmem_reserve[]: 0 0 0 0
[    7.222687] DMA: 8*4kB (UEM) 8*8kB (UM) 4*16kB (UEM) 5*32kB (UM) 2*64kB (M) 4*128kB (UEM) 3*256kB (M) 2*512kB (EM) 5*1024kB (UEM) 6*2048kB (UEM) 3*4096kB (EM) 88*8192kB (MR) = 753344kB
[    7.239477] HighMem: 0*4kB 0*8kB 1*16kB (M) 1*32kB (M) 2*64kB (UM) 2*128kB (UM) 2*256kB (UC) 3*512kB (UMC) 2*1024kB (UC) 2*2048kB (UC) 2*4096kB (UC) 30*8192kB (MRC) = 262576kB
[    7.255455] 1815 total pagecache pages
[    7.259211] 0 pages in swap cache
[    7.262533] Swap cache stats: add 0, delete 0, find 0/0
[    7.267764] Free swap  = 0kB
[    7.270647] Total swap = 0kB
[    7.282890] 262144 pages of RAM
[    7.286041] 254274 free pages
[    7.289013] 4763 reserved pages
[    7.292157] 929 slab pages
[    7.294868] 1063 pages shared
[    7.297839] 0 pages swap cached
Quoted 5 lines

And now we see 83 slab_reclaimable + 846 slab_unreclaimable adds up correctly to the total of 929.

The patch below will end up with the correct count.

Sorry, messed up the patch formatting. Here it is fixed:

8<===

arch/arm/mm/init.c +1 -1
index 1609b02..8d606bb 100644
@@ -117,7 +117,7 @@ void show_mem(unsigned int filter)
 			else if (PageSwapCache(page))
 				cached++;
 			else if (PageSlab(page))
-				slab++;
+				slab += 1 << compound_order(page);
 			else if (!page_count(page))
 				free++;
 			else
Signature · 1 line
 Gregory V. Fong >< GPG key: 782EF5EE
#17 lore raw
Quoted 8 lines · Gregory Fong
Quoted 5 lines · Gregory Fong

And now we see 83 slab_reclaimable + 846 slab_unreclaimable adds up correctly to the total of 929.

The patch below will end up with the correct count.

Sorry, messed up the patch formatting. Here it is fixed:

So now the question is: do we fix this, or do we use the generic version? Given that the total number of slab pages can be easily deduced from the generic statistics, do we need to modify the generic version to print an additional line with this? It seems wasteful to do so, and just adds more noise to the kernel's debug output.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#18 lore raw
Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Gregory Fong
Quoted 5 lines · Gregory Fong

And now we see 83 slab_reclaimable + 846 slab_unreclaimable adds up correctly to the total of 929.

The patch below will end up with the correct count.

Quoted 6 lines
Quoted 1 line

Sorry, messed up the patch formatting. Here it is fixed:

So now the question is: do we fix this, or do we use the generic version? Given that the total number of slab pages can be easily deduced from the generic statistics, do we need to modify the generic version to print an additional line with this?

Whatever ARM decides, I do not think the generic version needs to do a PFN walk to recaluate the SLAB statistics. The slab_reclaimable and slab_unreclaimable stats based on the vmstat counters is sufficient.

Signature · 2 lines
Mel Gorman
SUSE Labs
#19 lore raw
Quoted 11 lines · Mel Gorman
Quoted 10 lines · Russell King - ARM Linux
Quoted 8 lines · Gregory Fong
Quoted 5 lines · Gregory Fong

And now we see 83 slab_reclaimable + 846 slab_unreclaimable adds up correctly to the total of 929.

The patch below will end up with the correct count.

Sorry, messed up the patch formatting. Here it is fixed:

Quoted 8 lines
Quoted 4 lines

So now the question is: do we fix this, or do we use the generic version? Given that the total number of slab pages can be easily deduced from the generic statistics, do we need to modify the generic version to print an additional line with this?

Whatever ARM decides, I do not think the generic version needs to do a PFN walk to recaluate the SLAB statistics. The slab_reclaimable and slab_unreclaimable stats based on the vmstat counters is sufficient.

Yes, I agree. My feeling is we just switch to the generic version and be done with it.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#20 lore raw
Quoted 17 lines · Russell King - ARM Linux
Quoted 16 lines · Mel Gorman
Quoted 14 lines · Russell King - ARM Linux
Quoted 8 lines · Gregory Fong
Quoted 5 lines · Gregory Fong

And now we see 83 slab_reclaimable + 846 slab_unreclaimable adds up correctly to the total of 929.

The patch below will end up with the correct count.

Sorry, messed up the patch formatting. Here it is fixed:

So now the question is: do we fix this, or do we use the generic version? Given that the total number of slab pages can be easily deduced from the generic statistics, do we need to modify the generic version to print an additional line with this?

Quoted 6 lines
Quoted 3 lines

Whatever ARM decides, I do not think the generic version needs to do a PFN walk to recaluate the SLAB statistics. The slab_reclaimable and slab_unreclaimable stats based on the vmstat counters is sufficient.

Yes, I agree. My feeling is we just switch to the generic version and be done with it.

Agreed. This is really what I was hoping for in the first place, but didn't know before submitting the initial patch whether there was some arcane reason for the arm-specific show_mem.

If someone like Yalin really wants the total slab pages, they can just add slab_unreclaimable and slab_reclaimable (btw, Yalin, all emails I've sent to you are bouncing, maybe you'll see this since it's going to the list).

Thanks,
Gregory