[Devel] [PATCH RHEL7 COMMIT] mm: memcontrol: add swapin/out stats
Vladimir Davydov
vdavydov at virtuozzo.com
Thu Apr 28 06:55:26 PDT 2016
The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.14
------>
commit 3e15629611136095f9ad538336824b19ec0ff139
Author: Vladimir Davydov <vdavydov at virtuozzo.com>
Date: Thu Apr 28 17:55:26 2016 +0400
mm: memcontrol: add swapin/out stats
This patch adds pswpin and pswpout fields to memory.stat file. These
fields show the number of pages swapped in and out respectively for the
given memory cgroup. We assume a page was swapped in/out even if there
were no actual io (frontswap).
https://jira.sw.ru/browse/PSBM-46104
Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
mm/memcontrol.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 9ccc8080c2e0..342f65d966dc 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -112,6 +112,8 @@ static const char * const mem_cgroup_stat_names[] = {
enum mem_cgroup_events_index {
MEM_CGROUP_EVENTS_PGPGIN, /* # of pages paged in */
MEM_CGROUP_EVENTS_PGPGOUT, /* # of pages paged out */
+ MEM_CGROUP_EVENTS_PSWPIN, /* # of pages swapped in */
+ MEM_CGROUP_EVENTS_PSWPOUT, /* # of pages swapped out */
MEM_CGROUP_EVENTS_PGFAULT, /* # of page-faults */
MEM_CGROUP_EVENTS_PGMAJFAULT, /* # of major page-faults */
MEM_CGROUP_EVENTS_NSTATS,
@@ -120,6 +122,8 @@ enum mem_cgroup_events_index {
static const char * const mem_cgroup_events_names[] = {
"pgpgin",
"pgpgout",
+ "pswpin",
+ "pswpout",
"pgfault",
"pgmajfault",
};
@@ -3939,6 +3943,8 @@ __mem_cgroup_commit_charge_swapin(struct page *page, struct mem_cgroup *memcg,
swp_entry_t ent = {.val = page_private(page)};
mem_cgroup_uncharge_swap(ent);
}
+
+ this_cpu_inc(memcg->stat->events[MEM_CGROUP_EVENTS_PSWPIN]);
}
void mem_cgroup_commit_charge_swapin(struct page *page,
@@ -4228,6 +4234,9 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
*/
if (do_swap_account && swapout && memcg)
swap_cgroup_record(ent, css_id(&memcg->css));
+
+ if (swapout && memcg)
+ this_cpu_inc(memcg->stat->events[MEM_CGROUP_EVENTS_PSWPOUT]);
}
#endif
More information about the Devel
mailing list