The patch titled Subject: mm: cma: split cma-reserved in dmesg log has been added to the -mm tree. Its filename is mm-cma-split-cma-reserved-in-dmesg-log.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-cma-split-cma-reserved-in-dmesg-log.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-cma-split-cma-reserved-in-dmesg-log.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Pintu Kumar <pintu.k@xxxxxxxxxxx> Subject: mm: cma: split cma-reserved in dmesg log 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@xxxxxxxxxxx> Signed-off-by: Vishnu Pratap Singh <vishnu.ps@xxxxxxxxxxx> Cc: Rafael Aquini <aquini@xxxxxxxxxx> Cc: Jerome Marchand <jmarchan@xxxxxxxxxx> Cc: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx> Cc: Michal Nazarewicz <mina86@xxxxxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/cma.h | 1 + mm/cma.c | 1 + mm/page_alloc.c | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff -puN include/linux/cma.h~mm-cma-split-cma-reserved-in-dmesg-log include/linux/cma.h --- a/include/linux/cma.h~mm-cma-split-cma-reserved-in-dmesg-log +++ a/include/linux/cma.h @@ -15,6 +15,7 @@ struct cma; +extern unsigned long totalcma_pages; extern phys_addr_t cma_get_base(struct cma *cma); extern unsigned long cma_get_size(struct cma *cma); diff -puN mm/cma.c~mm-cma-split-cma-reserved-in-dmesg-log mm/cma.c --- a/mm/cma.c~mm-cma-split-cma-reserved-in-dmesg-log +++ a/mm/cma.c @@ -288,6 +288,7 @@ int __init cma_declare_contiguous(phys_a 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 -puN mm/page_alloc.c~mm-cma-split-cma-reserved-in-dmesg-log mm/page_alloc.c --- a/mm/page_alloc.c~mm-cma-split-cma-reserved-in-dmesg-log +++ a/mm/page_alloc.c @@ -110,6 +110,7 @@ static DEFINE_SPINLOCK(managed_page_coun unsigned long totalram_pages __read_mostly; unsigned long totalreserve_pages __read_mostly; +unsigned long totalcma_pages __read_mostly; /* * 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 ch 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 ch 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 _ Patches currently in -mm which might be from pintu.k@xxxxxxxxxxx are vmalloc-replace-printk-with-pr_warn.patch vmscan-replace-printk-with-pr_err.patch mm-cma-split-cma-reserved-in-dmesg-log.patch fs-proc-include-cma-info-in-proc-meminfo.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html