[Devel] [PATCH RHEL7 COMMIT] tcache/proc/meminfo: add tcache pages to MemAvailable
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Feb 19 03:47:01 PST 2016
The commit is pushed to "branch-rh7-3.10.0-327.4.5.vz7.11.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.4.5.vz7.11.4
------>
commit fee4b07010617de6d22f3ea50e14ea9806f1d0e4
Author: Vladimir Davydov <vdavydov at virtuozzo.com>
Date: Fri Feb 19 15:47:01 2016 +0400
tcache/proc/meminfo: add tcache pages to MemAvailable
Since they can be easily dropped at any moment, tcache pages should
contribute to MemAvailable.
Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
fs/proc/meminfo.c | 8 ++++++++
mm/tcache.c | 9 +++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 16960f7..8e9077f 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -75,6 +75,10 @@ static int meminfo_proc_show_mi(struct seq_file *m, struct meminfo *mi)
return 0;
}
+#ifdef CONFIG_TCACHE
+extern unsigned long get_nr_tcache_pages(void);
+#endif
+
int meminfo_proc_show_ub(struct seq_file *m, void *v,
struct user_beancounter *ub, unsigned long meminfo_val)
{
@@ -148,6 +152,10 @@ int meminfo_proc_show_ub(struct seq_file *m, void *v,
available += global_page_state(NR_SLAB_RECLAIMABLE) -
min(global_page_state(NR_SLAB_RECLAIMABLE) / 2, wmark_low);
+#ifdef CONFIG_TCACHE
+ available += get_nr_tcache_pages();
+#endif
+
if (available < 0)
available = 0;
diff --git a/mm/tcache.c b/mm/tcache.c
index fc58782..94c17f9d 100644
--- a/mm/tcache.c
+++ b/mm/tcache.c
@@ -1224,7 +1224,7 @@ static struct cleancache_ops tcache_cleancache_ops = {
.invalidate_fs = tcache_cleancache_invalidate_fs,
};
-static int param_get_nr_pages(char *buffer, const struct kernel_param *kp)
+unsigned long get_nr_tcache_pages(void)
{
int cpu;
long val = 0;
@@ -1233,7 +1233,12 @@ static int param_get_nr_pages(char *buffer, const struct kernel_param *kp)
val += per_cpu(nr_tcache_pages, cpu);
if (val < 0)
val = 0;
- return sprintf(buffer, "%lu", val);
+ return val;
+}
+
+static int param_get_nr_pages(char *buffer, const struct kernel_param *kp)
+{
+ return sprintf(buffer, "%lu", get_nr_tcache_pages());
}
static struct kernel_param_ops param_ops_nr_pages = {
More information about the Devel
mailing list