aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/meminfo.c
diff options
context:
space:
mode:
authorPintu Kumar <pintu.k@samsung.com>2014-12-18 19:17:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-18 22:08:10 -0500
commit47f8f9297d2247d65ee46d8403a73b30f8d0249b (patch)
treec6119a1597d46d5032bdfb2a67024ea1b952934d /fs/proc/meminfo.c
parente48322abb061d75096fe52d71886b237e7ae7bfb (diff)
fs/proc/meminfo.c: include cma info in proc/meminfo
This patch include CMA info (CMATotal, CMAFree) in /proc/meminfo. Currently, in a CMA enabled system, if somebody wants to know the total CMA size declared, there is no way to tell, other than the dmesg or /var/log/messages logs. With this patch we are showing the CMA info as part of meminfo, so that it can be determined at any point of time. This will be populated only when CMA is enabled. Below is the sample output from a ARM based device with RAM:512MB and CMA:16MB. MemTotal: 471172 kB MemFree: 111712 kB MemAvailable: 271172 kB . . . CmaTotal: 16384 kB CmaFree: 6144 kB This patch also fix below checkpatch errors that were found during these changes. ERROR: space required after that ',' (ctx:ExV) 199: FILE: fs/proc/meminfo.c:199: + ,atomic_long_read(&num_poisoned_pages) << (PAGE_SHIFT - 10) ^ ERROR: space required after that ',' (ctx:ExV) 202: FILE: fs/proc/meminfo.c:202: + ,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) * ^ ERROR: space required after that ',' (ctx:ExV) 206: FILE: fs/proc/meminfo.c:206: + ,K(totalcma_pages) ^ total: 3 errors, 0 warnings, 2 checks, 236 lines checked 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>
Diffstat (limited to 'fs/proc/meminfo.c')
-rw-r--r--fs/proc/meminfo.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index aa1eee06420f..d3ebf2e61853 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -12,6 +12,9 @@
12#include <linux/vmstat.h> 12#include <linux/vmstat.h>
13#include <linux/atomic.h> 13#include <linux/atomic.h>
14#include <linux/vmalloc.h> 14#include <linux/vmalloc.h>
15#ifdef CONFIG_CMA
16#include <linux/cma.h>
17#endif
15#include <asm/page.h> 18#include <asm/page.h>
16#include <asm/pgtable.h> 19#include <asm/pgtable.h>
17#include "internal.h" 20#include "internal.h"
@@ -138,6 +141,10 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
138#ifdef CONFIG_TRANSPARENT_HUGEPAGE 141#ifdef CONFIG_TRANSPARENT_HUGEPAGE
139 "AnonHugePages: %8lu kB\n" 142 "AnonHugePages: %8lu kB\n"
140#endif 143#endif
144#ifdef CONFIG_CMA
145 "CmaTotal: %8lu kB\n"
146 "CmaFree: %8lu kB\n"
147#endif
141 , 148 ,
142 K(i.totalram), 149 K(i.totalram),
143 K(i.freeram), 150 K(i.freeram),
@@ -187,12 +194,16 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
187 vmi.used >> 10, 194 vmi.used >> 10,
188 vmi.largest_chunk >> 10 195 vmi.largest_chunk >> 10
189#ifdef CONFIG_MEMORY_FAILURE 196#ifdef CONFIG_MEMORY_FAILURE
190 ,atomic_long_read(&num_poisoned_pages) << (PAGE_SHIFT - 10) 197 , atomic_long_read(&num_poisoned_pages) << (PAGE_SHIFT - 10)
191#endif 198#endif
192#ifdef CONFIG_TRANSPARENT_HUGEPAGE 199#ifdef CONFIG_TRANSPARENT_HUGEPAGE
193 ,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) * 200 , K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
194 HPAGE_PMD_NR) 201 HPAGE_PMD_NR)
195#endif 202#endif
203#ifdef CONFIG_CMA
204 , K(totalcma_pages)
205 , K(global_page_state(NR_FREE_CMA_PAGES))
206#endif
196 ); 207 );
197 208
198 hugetlb_report_meminfo(m); 209 hugetlb_report_meminfo(m);