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

Submitted by Andrey Ryabinin on March 31, 2017, 1:51 p.m.

Details

Message ID 20170331135111.16715-3-aryabinin@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Andrey Ryabinin March 31, 2017, 1:51 p.m.
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@virtuozzo.com>
---
 mm/memcontrol.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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