[Devel] [PATCH rh7 3/7] mm/memcg: fix kmem pages uncharging uncharge_batch()

Andrey Ryabinin aryabinin at virtuozzo.com
Fri Mar 31 06:51:07 PDT 2017


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



More information about the Devel mailing list