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

Submitted by Andrey Ryabinin on Feb. 12, 2018, 9:37 a.m.

Details

Message ID 20180212093712.24256-1-aryabinin@virtuozzo.com
State New
Series "mm/memcontrol: Fix memcg swpin/swpout stats accounting."
Headers show

Commit Message

Andrey Ryabinin Feb. 12, 2018, 9:37 a.m.
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@virtuozzo.com>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/memcontrol.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

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