[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <019601cfef75$8fbf8860$af3e9920$@samsung.com>
Date: Fri, 24 Oct 2014 16:00:27 +0530
From: PINTU KUMAR <pintu.k@...sung.com>
To: 'Michal Nazarewicz' <mina86@...a86.com>, akpm@...ux-foundation.org,
riel@...hat.com, aquini@...hat.com, paul.gortmaker@...driver.com,
jmarchan@...hat.com, lcapitulino@...hat.com,
kirill.shutemov@...ux.intel.com, m.szyprowski@...sung.com,
aneesh.kumar@...ux.vnet.ibm.com, iamjoonsoo.kim@....com,
lauraa@...eaurora.org, gioh.kim@....com, mgorman@...e.de,
rientjes@...gle.com, hannes@...xchg.org, vbabka@...e.cz,
sasha.levin@...cle.com, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Cc: pintu_agarwal@...oo.com, cpgs@...sung.com, vishnu.ps@...sung.com,
rohit.kr@...sung.com, ed.savinay@...sung.com
Subject: RE: [PATCH v2 1/2] mm: cma: split cma-reserved in dmesg log
----- Original Message -----
> From: Michal Nazarewicz <mina86@...a86.com>
> To: Pintu Kumar <pintu.k@...sung.com>; akpm@...ux-foundation.org; riel@...hat.com; pintu.k@...sung.com; aquini@...hat.com; paul.gortmaker@...driver.com; jmarchan@...hat.com; lcapitulino@...hat.com; kirill.shutemov@...ux.intel.com; m.szyprowski@...sung.com; aneesh.kumar@...ux.vnet.ibm.com; iamjoonsoo.kim@....com; lauraa@...eaurora.org; gioh.kim@....com; mgorman@...e.de; rientjes@...gle.com; hannes@...xchg.org; vbabka@...e.cz; sasha.levin@...cle.com; linux-kernel@...r.kernel.org; linux-mm@...ck.org
> Cc: pintu_agarwal@...oo.com; cpgs@...sung.com; vishnu.ps@...sung.com; rohit.kr@...sung.com; ed.savinay@...sung.com
> Sent: Thursday, 23 October 2014 10:31 PM
> Subject: Re: [PATCH v2 1/2] mm: cma: split cma-reserved in dmesg log
>
> On Wed, Oct 22 2014, Pintu Kumar wrote:
>> When the system boots up, in the dmesg logs we can see
>> the memory statistics along with total reserved as below.
>> Memory: 458840k/458840k available, 65448k reserved, 0K highmem
>>
>> When CMA is enabled, still the total reserved memory remains the same.
>> However, the CMA memory is not considered as reserved.
>> But, when we see /proc/meminfo, the CMA memory is part of free memory.
>> This creates confusion.
>> This patch corrects the problem by properly subtracting the CMA reserved
>> memory from the total reserved memory in dmesg logs.
>>
>> Below is the dmesg snapshot from an arm based device with 512MB RAM and
>> 12MB single CMA region.
>>
>> Before this change:
>> Memory: 458840k/458840k available, 65448k reserved, 0K highmem
>>
>> After this change:
>> Memory: 458840k/458840k available, 53160k reserved, 12288k cma-reserved, 0K
> highmem
>>
>> Signed-off-by: Pintu Kumar <pintu.k@...sung.com>
>> Signed-off-by: Vishnu Pratap Singh <vishnu.ps@...sung.com>
>
> Acked-by: Michal Nazarewicz <mina86@...a86.com>
>
>
> I'm not sure how Andrew would think about it, and I don't have strong
> feelings, but I would consider a few changes:
>
>> ---
>> v2: Moved totalcma_pages extern declaration to linux/cma.h
>> Removed CONFIG_CMA while show cma-reserved, from page_alloc.c
>> Moved totalcma_pages declaration to page_alloc.c, so that if will be
> visible
>> in non-CMA cases.
>> include/linux/cma.h | 1 +
>> mm/cma.c | 1 +
>> mm/page_alloc.c | 6 ++++--
>> 3 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/linux/cma.h b/include/linux/cma.h
>> index 0430ed0..0b75896 100644
>> --- a/include/linux/cma.h
>> +++ b/include/linux/cma.h
>> @@ -15,6 +15,7 @@
>>
>> struct cma;
>>
>> +extern unsigned long totalcma_pages;
>
> +#ifdef CONFIG_CMA
> +extern unsigned long totalcma_pages;
> +#else
> +# define totalcma_pages 0UL
> +#endif
>
>> extern phys_addr_t cma_get_base(struct cma *cma);
>> extern unsigned long cma_get_size(struct cma *cma);
>>
>> diff --git a/mm/cma.c b/mm/cma.c
>> index 963bc4a..8435762 100644
>> --- a/mm/cma.c
>> +++ b/mm/cma.c
>> @@ -288,6 +288,7 @@ int __init cma_declare_contiguous(phys_addr_t base,
>> if (ret)
>> goto err;
>>
>> + totalcma_pages += (size / PAGE_SIZE);
>> pr_info("Reserved %ld MiB at %08lx\n", (unsigned
> long)size / SZ_1M,
>> (unsigned long)base);
>> return 0;
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index dd73f9a..ababbd8 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -110,6 +110,7 @@ static DEFINE_SPINLOCK(managed_page_count_lock);
>>
>> unsigned long totalram_pages __read_mostly;
>> unsigned long totalreserve_pages __read_mostly;
>> +unsigned long totalcma_pages __read_mostly;
>
> Move this to cma.c.
>
In our earlier patch (first version), we added it in cmc.c itself.
But, Andrew wanted this variable to be visible in non-CMA case as well to avoid build error, when we use
this variable in mem_init_print_info, without CONFIG_CMA.
So, we moved it to page_alloc.c
>> /*
>> * When calculating the number of globally allowed dirty pages, there
>> * is a certain number of per-zone reserves that should not be
>> @@ -5520,7 +5521,7 @@ void __init mem_init_print_info(const char *str)
>>
>> pr_info("Memory: %luK/%luK available "
>> "(%luK kernel code, %luK rwdata, %luK rodata, "
>> - "%luK init, %luK bss, %luK reserved"
>> + "%luK init, %luK bss, %luK reserved, %luK
> cma-reserved"
>> #ifdef CONFIG_HIGHMEM
>> ", %luK highmem"
>> #endif
>> @@ -5528,7 +5529,8 @@ void __init mem_init_print_info(const char *str)
>> nr_free_pages() << (PAGE_SHIFT-10), physpages <<
> (PAGE_SHIFT-10),
>> codesize >> 10, datasize >> 10, rosize >> 10,
>> (init_data_size + init_code_size) >> 10, bss_size
>>> 10,
>> - (physpages - totalram_pages) << (PAGE_SHIFT-10),
>> + (physpages - totalram_pages - totalcma_pages) <<
> (PAGE_SHIFT-10),
>> + totalcma_pages << (PAGE_SHIFT-10),
>> #ifdef CONFIG_HIGHMEM
>> totalhigh_pages << (PAGE_SHIFT-10),
>> #endif
>> --
>> 1.7.9.5
>>
>
> --
> Best regards, _ _
> .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
> ..o | Computer Science, Michał “mina86” Nazarewicz (o o)
> ooo +--<mpn@...gle.com>--<xmpp:mina86@...ber.org>--ooO--(_)--Ooo--
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@...ck.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@...ck.org">
> email@...ck.org </a>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists