aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPintu Kumar <pintu.k@samsung.com>2014-12-18 19:17:15 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-18 22:08:10 -0500
commite48322abb061d75096fe52d71886b237e7ae7bfb (patch)
treef0fea5784bdc1e0e4afbda32cecdb03d179c3adb
parent89ac9b4d3d1a049ae1054f99b1aed81092cd0a82 (diff)
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@samsung.com> Signed-off-by: Vishnu Pratap Singh <vishnu.ps@samsung.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Cc: Rafael Aquini <aquini@redhat.com> Cc: Jerome Marchand <jmarchan@redhat.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/cma.h1
-rw-r--r--mm/cma.c1
-rw-r--r--mm/page_alloc.c6
3 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/cma.h b/include/linux/cma.h
index a93438beb33c..9384ba66e975 100644
--- a/include/linux/cma.h
+++ b/include/linux/cma.h
@@ -15,6 +15,7 @@
15 15
16struct cma; 16struct cma;
17 17
18extern unsigned long totalcma_pages;
18extern phys_addr_t cma_get_base(struct cma *cma); 19extern phys_addr_t cma_get_base(struct cma *cma);
19extern unsigned long cma_get_size(struct cma *cma); 20extern unsigned long cma_get_size(struct cma *cma);
20 21
diff --git a/mm/cma.c b/mm/cma.c
index f8917629cbdd..a85ae28709a3 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -337,6 +337,7 @@ int __init cma_declare_contiguous(phys_addr_t base,
337 if (ret) 337 if (ret)
338 goto err; 338 goto err;
339 339
340 totalcma_pages += (size / PAGE_SIZE);
340 pr_info("Reserved %ld MiB at %pa\n", (unsigned long)size / SZ_1M, 341 pr_info("Reserved %ld MiB at %pa\n", (unsigned long)size / SZ_1M,
341 &base); 342 &base);
342 return 0; 343 return 0;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index fa974d87f60d..7633c503a116 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -111,6 +111,7 @@ static DEFINE_SPINLOCK(managed_page_count_lock);
111 111
112unsigned long totalram_pages __read_mostly; 112unsigned long totalram_pages __read_mostly;
113unsigned long totalreserve_pages __read_mostly; 113unsigned long totalreserve_pages __read_mostly;
114unsigned long totalcma_pages __read_mostly;
114/* 115/*
115 * When calculating the number of globally allowed dirty pages, there 116 * When calculating the number of globally allowed dirty pages, there
116 * is a certain number of per-zone reserves that should not be 117 * is a certain number of per-zone reserves that should not be
@@ -5586,7 +5587,7 @@ void __init mem_init_print_info(const char *str)
5586 5587
5587 pr_info("Memory: %luK/%luK available " 5588 pr_info("Memory: %luK/%luK available "
5588 "(%luK kernel code, %luK rwdata, %luK rodata, " 5589 "(%luK kernel code, %luK rwdata, %luK rodata, "
5589 "%luK init, %luK bss, %luK reserved" 5590 "%luK init, %luK bss, %luK reserved, %luK cma-reserved"
5590#ifdef CONFIG_HIGHMEM 5591#ifdef CONFIG_HIGHMEM
5591 ", %luK highmem" 5592 ", %luK highmem"
5592#endif 5593#endif
@@ -5594,7 +5595,8 @@ void __init mem_init_print_info(const char *str)
5594 nr_free_pages() << (PAGE_SHIFT-10), physpages << (PAGE_SHIFT-10), 5595 nr_free_pages() << (PAGE_SHIFT-10), physpages << (PAGE_SHIFT-10),
5595 codesize >> 10, datasize >> 10, rosize >> 10, 5596 codesize >> 10, datasize >> 10, rosize >> 10,
5596 (init_data_size + init_code_size) >> 10, bss_size >> 10, 5597 (init_data_size + init_code_size) >> 10, bss_size >> 10,
5597 (physpages - totalram_pages) << (PAGE_SHIFT-10), 5598 (physpages - totalram_pages - totalcma_pages) << (PAGE_SHIFT-10),
5599 totalcma_pages << (PAGE_SHIFT-10),
5598#ifdef CONFIG_HIGHMEM 5600#ifdef CONFIG_HIGHMEM
5599 totalhigh_pages << (PAGE_SHIFT-10), 5601 totalhigh_pages << (PAGE_SHIFT-10),
5600#endif 5602#endif