[Devel] [PATCH rh7] mm/memcontrol: Fix memcg swpin/swpout stats accounting.

Andrey Ryabinin aryabinin at virtuozzo.com
Mon Feb 12 12:37:12 MSK 2018


memcg swpin/swpout stats were added in commit 81e2afa8125e
("mm: memcontrol: add swapin/out stats"). But broken later
in rebased upstream patch 33b7f8c4475f ("ms/mm: memcontrol: rewrite charge API").

Fixes: 33b7f8c4475f ("ms/mm: memcontrol: rewrite charge API")
Reported-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/memcontrol.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 325dee2cd903..62bc6fd7ceb8 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6893,6 +6893,7 @@ void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
 	pc->flags &= ~PCG_MEMSW;
 	css_get(&pc->mem_cgroup->css);
 	mem_cgroup_swap_statistics(pc->mem_cgroup, true);
+	this_cpu_inc(pc->mem_cgroup->stat->events[MEM_CGROUP_EVENTS_PSWPOUT]);
 }
 
 /**
@@ -6916,6 +6917,7 @@ void mem_cgroup_uncharge_swap(swp_entry_t entry)
 		if (!mem_cgroup_is_root(memcg))
 			page_counter_uncharge(&memcg->memsw, 1);
 		mem_cgroup_swap_statistics(memcg, false);
+		this_cpu_inc(memcg->stat->events[MEM_CGROUP_EVENTS_PSWPIN]);
 		css_put(&memcg->css);
 	}
 	rcu_read_unlock();
-- 
2.13.6



More information about the Devel mailing list