Commit 47f8f929 authored by Pintu Kumar's avatar Pintu Kumar Committed by Linus Torvalds
Browse files

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: default avatarPintu Kumar <>
Signed-off-by: default avatarVishnu Pratap Singh <>
Acked-by: default avatarMichal Nazarewicz <>
Cc: Rafael Aquini <>
Cc: Jerome Marchand <>
Cc: Marek Szyprowski <>
Cc: Joonsoo Kim <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent e48322ab
......@@ -12,6 +12,9 @@
#include <linux/vmstat.h>
#include <linux/atomic.h>
#include <linux/vmalloc.h>
#include <linux/cma.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include "internal.h"
......@@ -137,6 +140,10 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
"AnonHugePages: %8lu kB\n"
"CmaTotal: %8lu kB\n"
"CmaFree: %8lu kB\n"
......@@ -187,11 +194,15 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
vmi.used >> 10,
vmi.largest_chunk >> 10
,atomic_long_read(&num_poisoned_pages) << (PAGE_SHIFT - 10)
, atomic_long_read(&num_poisoned_pages) << (PAGE_SHIFT - 10)
, K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
, K(totalcma_pages)
, K(global_page_state(NR_FREE_CMA_PAGES))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment