[Devel] [PATCH RHEL7 COMMIT] mm/memcontrol: Fix memcg swpin/swpout stats accounting

Konstantin Khorenko khorenko at virtuozzo.com
Tue Feb 13 17:09:55 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.17.1.vz7.43.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.17.1.vz7.43.4
------>
commit 72ddcc1dac5842345925c81360cf12bec204a428
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Tue Feb 13 17:09:55 2018 +0300

    mm/memcontrol: Fix memcg swpin/swpout stats accounting
    
    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 c570b04a9d66..a3f118cba1b3 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6906,6 +6906,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]);
 }
 
 /**
@@ -6929,6 +6930,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();


More information about the Devel mailing list