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 <aryabi...@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);
        }
-- 
2.10.2

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to