[Devel] [PATCH RHEL7 COMMIT] mm: memcontrol: fix meminfo:SUnreclaim output in containers

Konstantin Khorenko khorenko at virtuozzo.com
Thu May 19 04:23:42 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.4
------>
commit 7d56fdd9f4c2807a2a952548d8386da7a7fd6565
Author: Vladimir Davydov <vdavydov at virtuozzo.com>
Date:   Thu May 19 15:23:41 2016 +0400

    mm: memcontrol: fix meminfo:SUnreclaim output in containers
    
    We calculate SUnreclaim as total kmem usage minus SReclaimable. This is
    wrong, because kmem also charges non-slab objects, such as page tables
    and kernel stack pages.
    
    Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 mm/memcontrol.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f42f770..4763520 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4979,17 +4979,15 @@ static unsigned long mem_cgroup_recursive_stat(struct mem_cgroup *memcg,
 void mem_cgroup_fill_meminfo(struct mem_cgroup *memcg, struct meminfo *mi)
 {
 	int nid;
-	unsigned long slab;
 
 	memset(&mi->pages, 0, sizeof(mi->pages));
 	for_each_online_node(nid)
 		mem_cgroup_get_nr_pages(memcg, nid, mi->pages);
 
-	slab = res_counter_read_u64(&memcg->kmem, RES_USAGE) >> PAGE_SHIFT;
-	mi->slab_reclaimable = res_counter_read_u64(&memcg->dcache, RES_USAGE)
-								>> PAGE_SHIFT;
-	mi->slab_unreclaimable = max_t(long, slab - mi->slab_reclaimable, 0);
-
+	mi->slab_reclaimable = mem_cgroup_recursive_stat(memcg,
+					MEM_CGROUP_STAT_SLAB_RECLAIMABLE);
+	mi->slab_unreclaimable = mem_cgroup_recursive_stat(memcg,
+					MEM_CGROUP_STAT_SLAB_UNRECLAIMABLE);
 	mi->cached = mem_cgroup_recursive_stat(memcg, MEM_CGROUP_STAT_CACHE);
 	mi->shmem = mem_cgroup_recursive_stat(memcg, MEM_CGROUP_STAT_SHMEM);
 }


More information about the Devel mailing list