* [PATCH] ARM: print cma-reserved pages from show_mem @ 2015-02-04 23:22 Gregory Fong 2015-02-06 0:41 ` Laura Abbott 0 siblings, 1 reply; 21+ messages in thread From: Gregory Fong @ 2015-02-04 23:22 UTC (permalink / raw) To: linux-arm-kernel 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". Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com> --- arch/arm/mm/init.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 2495c8c..da77507 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -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); -- 1.9.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-02-04 23:22 [PATCH] ARM: print cma-reserved pages from show_mem Gregory Fong @ 2015-02-06 0:41 ` Laura Abbott 2015-02-06 21:14 ` Gregory Fong 0 siblings, 1 reply; 21+ messages in thread From: Laura Abbott @ 2015-02-06 0:41 UTC (permalink / raw) To: linux-arm-kernel On 2/4/2015 3:22 PM, Gregory Fong wrote: > 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". > > Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com> > --- > arch/arm/mm/init.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c > index 2495c8c..da77507 100644 > --- a/arch/arm/mm/init.c > +++ b/arch/arm/mm/init.c > @@ -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 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 -- Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-02-06 0:41 ` Laura Abbott @ 2015-02-06 21:14 ` Gregory Fong 2015-02-06 21:41 ` Laura Abbott 0 siblings, 1 reply; 21+ messages in thread From: Gregory Fong @ 2015-02-06 21:14 UTC (permalink / raw) To: linux-arm-kernel On Thu, Feb 5, 2015 at 4:41 PM, Laura Abbott <lauraa@codeaurora.org> wrote: > On 2/4/2015 3:22 PM, Gregory Fong wrote: >> >> 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". >> >> Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com> >> --- >> arch/arm/mm/init.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c >> index 2495c8c..da77507 100644 >> --- a/arch/arm/mm/init.c >> +++ b/arch/arm/mm/init.c >> @@ -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 > > > 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-02-06 21:14 ` Gregory Fong @ 2015-02-06 21:41 ` Laura Abbott 2015-02-09 19:55 ` Gregory Fong 0 siblings, 1 reply; 21+ messages in thread From: Laura Abbott @ 2015-02-06 21:41 UTC (permalink / raw) To: linux-arm-kernel On 2/6/2015 1:14 PM, Gregory Fong wrote: > On Thu, Feb 5, 2015 at 4:41 PM, Laura Abbott <lauraa@codeaurora.org> wrote: >> On 2/4/2015 3:22 PM, Gregory Fong wrote: >>> >>> 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". >>> >>> Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com> >>> --- >>> arch/arm/mm/init.c | 4 ++++ >>> 1 file changed, 4 insertions(+) >>> >>> diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c >>> index 2495c8c..da77507 100644 >>> --- a/arch/arm/mm/init.c >>> +++ b/arch/arm/mm/init.c >>> @@ -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 >> >> >> 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. > 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 -- Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-02-06 21:41 ` Laura Abbott @ 2015-02-09 19:55 ` Gregory Fong 2015-02-10 11:32 ` Russell King - ARM Linux 0 siblings, 1 reply; 21+ messages in thread From: Gregory Fong @ 2015-02-09 19:55 UTC (permalink / raw) To: linux-arm-kernel On Fri, Feb 6, 2015 at 1:41 PM, Laura Abbott <lauraa@codeaurora.org> wrote: > On 2/6/2015 1:14 PM, Gregory Fong wrote: >> >> On Thu, Feb 5, 2015 at 4:41 PM, Laura Abbott <lauraa@codeaurora.org> >> wrote: >>> >>> On 2/4/2015 3:22 PM, Gregory Fong wrote: >>>> >>>> >>>> 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". >>>> >>>> Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com> >>>> --- >>>> arch/arm/mm/init.c | 4 ++++ >>>> 1 file changed, 4 insertions(+) >>>> >>>> diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c >>>> index 2495c8c..da77507 100644 >>>> --- a/arch/arm/mm/init.c >>>> +++ b/arch/arm/mm/init.c >>>> @@ -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 >>> >>> >>> >>> 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. >> > > 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: 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-02-09 19:55 ` Gregory Fong @ 2015-02-10 11:32 ` Russell King - ARM Linux 2015-03-23 9:08 ` Gregory Fong 0 siblings, 1 reply; 21+ messages in thread From: Russell King - ARM Linux @ 2015-02-10 11:32 UTC (permalink / raw) To: linux-arm-kernel On Mon, Feb 09, 2015 at 11:55:54AM -0800, Gregory Fong wrote: > On Fri, Feb 6, 2015 at 1:41 PM, Laura Abbott <lauraa@codeaurora.org> wrote: > > 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: > > 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. -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-02-10 11:32 ` Russell King - ARM Linux @ 2015-03-23 9:08 ` Gregory Fong 2015-03-25 11:49 ` Mel Gorman 2015-03-26 11:46 ` Russell King - ARM Linux 0 siblings, 2 replies; 21+ messages in thread From: Gregory Fong @ 2015-03-23 9:08 UTC (permalink / raw) To: linux-arm-kernel Hello, On Tue, Feb 10, 2015 at 3:32 AM, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote: > On Mon, Feb 09, 2015 at 11:55:54AM -0800, Gregory Fong wrote: >> On Fri, Feb 6, 2015 at 1:41 PM, Laura Abbott <lauraa@codeaurora.org> wrote: >> > 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: >> >> 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. > 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-03-23 9:08 ` Gregory Fong @ 2015-03-25 11:49 ` Mel Gorman 2015-03-26 11:46 ` Russell King - ARM Linux 1 sibling, 0 replies; 21+ messages in thread From: Mel Gorman @ 2015-03-25 11:49 UTC (permalink / raw) To: linux-arm-kernel On Mon, Mar 23, 2015 at 02:08:12AM -0700, Gregory Fong wrote: > Hello, > > On Tue, Feb 10, 2015 at 3:32 AM, Russell King - ARM Linux > <linux@arm.linux.org.uk> wrote: > > On Mon, Feb 09, 2015 at 11:55:54AM -0800, Gregory Fong wrote: > >> On Fri, Feb 6, 2015 at 1:41 PM, Laura Abbott <lauraa@codeaurora.org> wrote: > >> > 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: > >> > >> 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. > > > > 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. -- Mel Gorman SUSE Labs ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-03-23 9:08 ` Gregory Fong 2015-03-25 11:49 ` Mel Gorman @ 2015-03-26 11:46 ` Russell King - ARM Linux 2015-03-26 12:30 ` Mel Gorman 1 sibling, 1 reply; 21+ messages in thread From: Russell King - ARM Linux @ 2015-03-26 11:46 UTC (permalink / raw) To: linux-arm-kernel On Mon, Mar 23, 2015 at 02:08:12AM -0700, Gregory Fong wrote: > Hello, > > On Tue, Feb 10, 2015 at 3:32 AM, Russell King - ARM Linux > <linux@arm.linux.org.uk> wrote: > > On Mon, Feb 09, 2015 at 11:55:54AM -0800, Gregory Fong wrote: > >> On Fri, Feb 6, 2015 at 1:41 PM, Laura Abbott <lauraa@codeaurora.org> wrote: > >> > 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: > >> > >> 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. > > > > 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 <rmk+kernel@arm.linux.org.uk> 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. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> --- arch/arm/mm/init.c | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 1609b022a72f..ae369c1066e6 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -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) { -- 1.8.3.1 -- FTTC broadband for 0.8mile line: currently@10.5Mbps down 400kbps up according to speedtest.net. ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-03-26 11:46 ` Russell King - ARM Linux @ 2015-03-26 12:30 ` Mel Gorman 2015-03-26 13:22 ` Russell King - ARM Linux 2015-04-10 4:36 ` Gregory Fong 0 siblings, 2 replies; 21+ messages in thread From: Mel Gorman @ 2015-03-26 12:30 UTC (permalink / raw) To: linux-arm-kernel On Thu, Mar 26, 2015 at 11:46:12AM +0000, Russell King - ARM Linux wrote: > <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. > 8<=== > From: Russell King <rmk+kernel@arm.linux.org.uk> > 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. > > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> If this builds, boots and sysrq-m works as expected then for what it's worth Acked-by: Mel Gorman <mgorman <mgorman@suse.de> -- Mel Gorman SUSE Labs ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-03-26 12:30 ` Mel Gorman @ 2015-03-26 13:22 ` Russell King - ARM Linux 2015-03-26 13:47 ` Mel Gorman 2015-04-10 4:36 ` Gregory Fong 1 sibling, 1 reply; 21+ messages in thread From: Russell King - ARM Linux @ 2015-03-26 13:22 UTC (permalink / raw) To: linux-arm-kernel On Thu, Mar 26, 2015 at 12:30:29PM +0000, Mel Gorman wrote: > On Thu, Mar 26, 2015 at 11:46:12AM +0000, Russell King - ARM Linux wrote: > > <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. 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. -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-03-26 13:22 ` Russell King - ARM Linux @ 2015-03-26 13:47 ` Mel Gorman 0 siblings, 0 replies; 21+ messages in thread From: Mel Gorman @ 2015-03-26 13:47 UTC (permalink / raw) To: linux-arm-kernel On Thu, Mar 26, 2015 at 01:22:59PM +0000, Russell King - ARM Linux wrote: > On Thu, Mar 26, 2015 at 12:30:29PM +0000, Mel Gorman wrote: > > On Thu, Mar 26, 2015 at 11:46:12AM +0000, Russell King - ARM Linux wrote: > > > <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. > > 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. -- Mel Gorman SUSE Labs ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-03-26 12:30 ` Mel Gorman 2015-03-26 13:22 ` Russell King - ARM Linux @ 2015-04-10 4:36 ` Gregory Fong 2015-04-10 5:18 ` Wang, Yalin 1 sibling, 1 reply; 21+ messages in thread From: Gregory Fong @ 2015-04-10 4:36 UTC (permalink / raw) To: linux-arm-kernel On Thu, Mar 26, 2015 at 5:30 AM, Mel Gorman <mgorman@suse.de> wrote: > On Thu, Mar 26, 2015 at 11:46:12AM +0000, Russell King - ARM Linux wrote: >> <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. > >> 8<=== >> From: Russell King <rmk+kernel@arm.linux.org.uk> >> 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. >> >> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> > > If this builds, boots and sysrq-m works as expected then for what it's worth > > Acked-by: Mel Gorman <mgorman <mgorman@suse.de> 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. Tested-by: Gregory Fong <gregory.0xf0@gmail.com> 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-04-10 4:36 ` Gregory Fong @ 2015-04-10 5:18 ` Wang, Yalin 2015-04-10 11:24 ` Russell King - ARM Linux 0 siblings, 1 reply; 21+ messages in thread From: Wang, Yalin @ 2015-04-10 5:18 UTC (permalink / raw) To: linux-arm-kernel > -----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 > > On Thu, Mar 26, 2015 at 5:30 AM, Mel Gorman <mgorman@suse.de> wrote: > > On Thu, Mar 26, 2015 at 11:46:12AM +0000, Russell King - ARM Linux wrote: > >> <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. > > > >> 8<=== > >> From: Russell King <rmk+kernel@arm.linux.org.uk> > >> 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. > >> > >> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> > > > > If this builds, boots and sysrq-m works as expected then for what it's > worth > > > > Acked-by: Mel Gorman <mgorman <mgorman@suse.de> > > 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. > > Tested-by: Gregory Fong <gregory.0xf0@gmail.com> > > 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 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-04-10 5:18 ` Wang, Yalin @ 2015-04-10 11:24 ` Russell King - ARM Linux 2015-04-13 1:09 ` Gregory Fong 0 siblings, 1 reply; 21+ messages in thread From: Russell King - ARM Linux @ 2015-04-10 11:24 UTC (permalink / raw) To: linux-arm-kernel On Fri, Apr 10, 2015 at 01:18:04PM +0800, Wang, Yalin wrote: > > [ 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. > > [ 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. > > [ 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. -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-04-10 11:24 ` Russell King - ARM Linux @ 2015-04-13 1:09 ` Gregory Fong 2015-04-13 1:21 ` Gregory Fong 0 siblings, 1 reply; 21+ messages in thread From: Gregory Fong @ 2015-04-13 1:09 UTC (permalink / raw) To: linux-arm-kernel On Fri, Apr 10, 2015 at 12:24:31PM +0100, Russell King - ARM Linux wrote: > On Fri, Apr 10, 2015 at 01:18:04PM +0800, Wang, Yalin wrote: > > > [ 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. > > > > [ 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. > > > > [ 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... 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<=== diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 1609b02..8d606bb 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -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 -- Gregory V. Fong >< GPG key: 0BAE9648 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-04-13 1:09 ` Gregory Fong @ 2015-04-13 1:21 ` Gregory Fong 2015-04-13 9:56 ` Russell King - ARM Linux 0 siblings, 1 reply; 21+ messages in thread From: Gregory Fong @ 2015-04-13 1:21 UTC (permalink / raw) To: linux-arm-kernel On Sun, Apr 12, 2015 at 06:09:13PM -0700, Gregory Fong wrote: > On Fri, Apr 10, 2015 at 12:24:31PM +0100, Russell King - ARM Linux wrote: > > On Fri, Apr 10, 2015 at 01:18:04PM +0800, Wang, Yalin wrote: > > > > [ 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. > > > > > > [ 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. > > > > > > [ 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... > > 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. > Sorry, messed up the patch formatting. Here it is fixed: 8<=== diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 1609b02..8d606bb 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -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 -- Gregory V. Fong >< GPG key: 782EF5EE ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-04-13 1:21 ` Gregory Fong @ 2015-04-13 9:56 ` Russell King - ARM Linux 2015-04-13 10:04 ` Mel Gorman 0 siblings, 1 reply; 21+ messages in thread From: Russell King - ARM Linux @ 2015-04-13 9:56 UTC (permalink / raw) To: linux-arm-kernel On Sun, Apr 12, 2015 at 06:21:15PM -0700, Gregory Fong wrote: > On Sun, Apr 12, 2015 at 06:09:13PM -0700, Gregory Fong wrote: > > 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. -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-04-13 9:56 ` Russell King - ARM Linux @ 2015-04-13 10:04 ` Mel Gorman 2015-04-13 10:05 ` Russell King - ARM Linux 0 siblings, 1 reply; 21+ messages in thread From: Mel Gorman @ 2015-04-13 10:04 UTC (permalink / raw) To: linux-arm-kernel On Mon, Apr 13, 2015 at 10:56:45AM +0100, Russell King - ARM Linux wrote: > On Sun, Apr 12, 2015 at 06:21:15PM -0700, Gregory Fong wrote: > > On Sun, Apr 12, 2015 at 06:09:13PM -0700, Gregory Fong wrote: > > > 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? 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. -- Mel Gorman SUSE Labs ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-04-13 10:04 ` Mel Gorman @ 2015-04-13 10:05 ` Russell King - ARM Linux 2015-04-13 12:29 ` Gregory Fong 0 siblings, 1 reply; 21+ messages in thread From: Russell King - ARM Linux @ 2015-04-13 10:05 UTC (permalink / raw) To: linux-arm-kernel On Mon, Apr 13, 2015 at 11:04:26AM +0100, Mel Gorman wrote: > On Mon, Apr 13, 2015 at 10:56:45AM +0100, Russell King - ARM Linux wrote: > > On Sun, Apr 12, 2015 at 06:21:15PM -0700, Gregory Fong wrote: > > > On Sun, Apr 12, 2015 at 06:09:13PM -0700, Gregory Fong wrote: > > > > 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? > > 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. -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] ARM: print cma-reserved pages from show_mem 2015-04-13 10:05 ` Russell King - ARM Linux @ 2015-04-13 12:29 ` Gregory Fong 0 siblings, 0 replies; 21+ messages in thread From: Gregory Fong @ 2015-04-13 12:29 UTC (permalink / raw) To: linux-arm-kernel On Mon, Apr 13, 2015 at 3:05 AM, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote: > On Mon, Apr 13, 2015 at 11:04:26AM +0100, Mel Gorman wrote: >> On Mon, Apr 13, 2015 at 10:56:45AM +0100, Russell King - ARM Linux wrote: >> > On Sun, Apr 12, 2015 at 06:21:15PM -0700, Gregory Fong wrote: >> > > On Sun, Apr 12, 2015 at 06:09:13PM -0700, Gregory Fong wrote: >> > > > 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? >> >> 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2015-04-13 12:29 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-02-04 23:22 [PATCH] ARM: print cma-reserved pages from show_mem Gregory Fong 2015-02-06 0:41 ` Laura Abbott 2015-02-06 21:14 ` Gregory Fong 2015-02-06 21:41 ` Laura Abbott 2015-02-09 19:55 ` Gregory Fong 2015-02-10 11:32 ` Russell King - ARM Linux 2015-03-23 9:08 ` Gregory Fong 2015-03-25 11:49 ` Mel Gorman 2015-03-26 11:46 ` Russell King - ARM Linux 2015-03-26 12:30 ` Mel Gorman 2015-03-26 13:22 ` Russell King - ARM Linux 2015-03-26 13:47 ` Mel Gorman 2015-04-10 4:36 ` Gregory Fong 2015-04-10 5:18 ` Wang, Yalin 2015-04-10 11:24 ` Russell King - ARM Linux 2015-04-13 1:09 ` Gregory Fong 2015-04-13 1:21 ` Gregory Fong 2015-04-13 9:56 ` Russell King - ARM Linux 2015-04-13 10:04 ` Mel Gorman 2015-04-13 10:05 ` Russell King - ARM Linux 2015-04-13 12:29 ` Gregory Fong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).