linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] CMA: add the amount of cma memory in meminfo
@ 2014-12-19  1:33 Xishi Qiu
  2014-12-19 21:50 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Xishi Qiu @ 2014-12-19  1:33 UTC (permalink / raw)
  To: Andrew Morton, m.szyprowski, Michal Nazarewicz, aneesh.kumar,
	iamjoonsoo.kim, vishnu.ps
  Cc: LKML, Linux MM, Xishi Qiu

Add the amount of cma memory in the following meminfo.
/proc/meminfo
/sys/devices/system/node/nodeXX/meminfo

Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
---
 drivers/base/node.c | 16 ++++++++++------
 fs/proc/meminfo.c   |  6 ++++++
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 472168c..bc123f9 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -120,6 +120,9 @@ static ssize_t node_read_meminfo(struct device *dev,
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 		       "Node %d AnonHugePages:  %8lu kB\n"
 #endif
+#ifdef CONFIG_CMA
+		       "Node %d FreeCMAPages:   %8lu kB\n"
+#endif
 			,
 		       nid, K(node_page_state(nid, NR_FILE_DIRTY)),
 		       nid, K(node_page_state(nid, NR_WRITEBACK)),
@@ -136,14 +139,15 @@ static ssize_t node_read_meminfo(struct device *dev,
 		       nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE) +
 				node_page_state(nid, NR_SLAB_UNRECLAIMABLE)),
 		       nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE)),
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
 		       nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))
-			, nid,
-			K(node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) *
-			HPAGE_PMD_NR));
-#else
-		       nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE)));
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+		       ,nid, K(node_page_state(nid,
+			NR_ANON_TRANSPARENT_HUGEPAGES) * HPAGE_PMD_NR)
+#endif
+#ifdef CONFIG_CMA
+		       ,nid, K(node_page_state(nid, NR_FREE_CMA_PAGES))
 #endif
+			);
 	n += hugetlb_report_node_meminfo(nid, buf + n);
 	return n;
 }
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index aa1eee0..9a7e446 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -138,6 +138,9 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 		"AnonHugePages:  %8lu kB\n"
 #endif
+#ifdef CONFIG_CMA
+		"FreeCMAPages:   %8lu kB\n"
+#endif
 		,
 		K(i.totalram),
 		K(i.freeram),
@@ -193,6 +196,9 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 		,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
 		   HPAGE_PMD_NR)
 #endif
+#ifdef CONFIG_CMA
+		,K(global_page_state(NR_FREE_CMA_PAGES))
+#endif
 		);
 
 	hugetlb_report_meminfo(m);
-- 
2.0.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH V2] CMA: add the amount of cma memory in meminfo
  2014-12-19  1:33 [PATCH V2] CMA: add the amount of cma memory in meminfo Xishi Qiu
@ 2014-12-19 21:50 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2014-12-19 21:50 UTC (permalink / raw)
  To: Xishi Qiu
  Cc: m.szyprowski, Michal Nazarewicz, aneesh.kumar, iamjoonsoo.kim,
	vishnu.ps, LKML, Linux MM

On Fri, 19 Dec 2014 09:33:06 +0800 Xishi Qiu <qiuxishi@huawei.com> wrote:

> Add the amount of cma memory in the following meminfo.
> /proc/meminfo

We just did this.

> /sys/devices/system/node/nodeXX/meminfo

But not this.

See

commit 47f8f9297d2247d65ee46d8403a73b30f8d0249b
Author: Pintu Kumar <pintu.k@samsung.com>
Date:   Thu Dec 18 16:17:18 2014 -0800

    fs/proc/meminfo.c: include cma info in proc/meminfo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-19 21:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-19  1:33 [PATCH V2] CMA: add the amount of cma memory in meminfo Xishi Qiu
2014-12-19 21:50 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).