[Devel] [PATCH RHEL7 COMMIT] mm/memcg: fix kmem pages uncharging uncharge_batch()

Konstantin Khorenko khorenko at virtuozzo.com
Fri Mar 31 08:13:17 PDT 2017


The commit is pushed to "branch-rh7-3.10.0-514.10.2.vz7.29.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.10.2.vz7.29.9
------>
commit 23dbf726add4d28fdeeea350fdab8ead3a2e0cd7
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Fri Mar 31 19:13:17 2017 +0400

    mm/memcg: fix kmem pages uncharging uncharge_batch()
    
    We don't uncharge nr_kmem pages from ->mem and ->memsw
    if nr_mem == 0 and nr_memsw == 0.
    We don't uncharge nr_kmem from ->kmem page counter.
    
    https://jira.sw.ru/browse/PSBM-62827
    
    Fixes: fe9a4e1e4c8f ("ms/mm: memcontrol: teach uncharge_list to deal with kmem pages")
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/memcontrol.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6163e55..13d4205 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6972,10 +6972,12 @@ static void uncharge_batch(struct mem_cgroup *memcg, unsigned long pgpgout,
 	unsigned long flags;
 
 	if (!mem_cgroup_is_root(memcg)) {
-		if (nr_mem)
+		if (nr_mem + nr_kmem)
 			page_counter_uncharge(&memcg->memory, nr_mem + nr_kmem);
-		if (nr_memsw)
+		if (nr_memsw + nr_kmem)
 			page_counter_uncharge(&memcg->memsw, nr_memsw + nr_kmem);
+		if (nr_kmem)
+			page_counter_uncharge(&memcg->kmem, nr_kmem);
 
 		memcg_oom_recover(memcg);
 	}


More information about the Devel mailing list