[Devel] [PATCH RHEL7 COMMIT] meminfo: show size of tcache and tswap

Vladimir Davydov vdavydov at virtuozzo.com
Thu Apr 28 06:55:26 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.14
------>
commit c4b48849c4feaf45879b0ee8bad335f669a54459
Author: Vladimir Davydov <vdavydov at virtuozzo.com>
Date:   Thu Apr 28 17:55:25 2016 +0400

    meminfo: show size of tcache and tswap
    
    Although these counters are already available via
    /sys/module/{tcache,tswap}/parameters/nr_pages, having them in
    /proc/meminfo will come handy, e.g. because meminfo is already
    gathered by perf tests, while those counters are not.
    
    Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 fs/proc/meminfo.c | 15 +++++++++++++++
 mm/tswap.c        |  5 +++++
 2 files changed, 20 insertions(+)

diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 8e9077fea885..40db369116b4 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -78,6 +78,9 @@ static int meminfo_proc_show_mi(struct seq_file *m, struct meminfo *mi)
 #ifdef CONFIG_TCACHE
 extern unsigned long get_nr_tcache_pages(void);
 #endif
+#ifdef CONFIG_TSWAP
+extern unsigned long get_nr_tswap_pages(void);
+#endif
 
 int meminfo_proc_show_ub(struct seq_file *m, void *v,
 		struct user_beancounter *ub, unsigned long meminfo_val)
@@ -215,6 +218,12 @@ int meminfo_proc_show_ub(struct seq_file *m, void *v,
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 		"AnonHugePages:  %8lu kB\n"
 #endif
+#ifdef CONFIG_TCACHE
+		"Tcache:         %8lu kB\n"
+#endif
+#ifdef CONFIG_TSWAP
+		"Tswap:          %8lu kB\n"
+#endif
 		,
 		K(i.totalram),
 		K(i.freeram),
@@ -276,6 +285,12 @@ int meminfo_proc_show_ub(struct seq_file *m, void *v,
 		,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
 		   HPAGE_PMD_NR)
 #endif
+#ifdef CONFIG_TCACHE
+		,K(get_nr_tcache_pages())
+#endif
+#ifdef CONFIG_TSWAP
+		,K(get_nr_tswap_pages())
+#endif
 		);
 
 	hugetlb_report_meminfo(m);
diff --git a/mm/tswap.c b/mm/tswap.c
index 20c952b4716c..258728519364 100644
--- a/mm/tswap.c
+++ b/mm/tswap.c
@@ -38,6 +38,11 @@ module_param_named(active, tswap_active, bool, 0644);
 static unsigned long tswap_nr_pages;
 module_param_named(nr_pages, tswap_nr_pages, ulong, 0444);
 
+unsigned long get_nr_tswap_pages(void)
+{
+	return tswap_nr_pages;
+}
+
 static void tswap_lru_add(struct page *page)
 {
 	struct tswap_lru *lru = &tswap_lru_node[page_to_nid(page)];


More information about the Devel mailing list