From: Huang Ying <ying.huang(a)intel.com>
ANBZ: #80
cherry-picked from
https://git.kernel.org/pub/scm/linux/kernel/git/vishal/tiering.git/commit/?…
To distinguish the file pages demotion from the anonymous pages
demotion. This can be used to check the balance between the
file/anonymous pages demotion.
Signed-off-by: "Huang, Ying" <ying.huang(a)intel.com>
Signed-off-by: Baolin Wang <baolin.wang(a)linux.alibaba.com>
---
include/linux/vm_event_item.h | 1 +
mm/vmscan.c | 4 ++++
mm/vmstat.c | 1 +
3 files changed, 6 insertions(+)
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 8984994..d5419b3 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -34,6 +34,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
PGSTEAL_DIRECT,
PGDEMOTE_KSWAPD,
PGDEMOTE_DIRECT,
+ PGDEMOTE_FILE,
PGSCAN_KSWAPD,
PGSCAN_DIRECT,
PGSCAN_DIRECT_THROTTLE,
diff --git a/mm/vmscan.c b/mm/vmscan.c
index ab79a20..fa9e268 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1135,6 +1135,7 @@ static unsigned int demote_page_list(struct list_head
*demote_pages,
int target_nid = next_demotion_node(pgdat->node_id);
unsigned int nr_succeeded;
int err;
+ bool file_lru;
if (list_empty(demote_pages))
return 0;
@@ -1142,6 +1143,7 @@ static unsigned int demote_page_list(struct list_head
*demote_pages,
if (target_nid == NUMA_NO_NODE)
return 0;
+ file_lru = page_is_file_cache(lru_to_page(demote_pages));
/* Demotion ignores all cpuset and mempolicy settings */
err = migrate_pages(demote_pages, alloc_demote_page, NULL,
target_nid, MIGRATE_ASYNC, MR_DEMOTION,
@@ -1151,6 +1153,8 @@ static unsigned int demote_page_list(struct list_head
*demote_pages,
__count_vm_events(PGDEMOTE_KSWAPD, nr_succeeded);
else
__count_vm_events(PGDEMOTE_DIRECT, nr_succeeded);
+ if (file_lru)
+ __count_vm_events(PGDEMOTE_FILE, nr_succeeded);
return nr_succeeded;
}
diff --git a/mm/vmstat.c b/mm/vmstat.c
index a92a7ad..3ca0d88 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1222,6 +1222,7 @@ int fragmentation_index(struct zone *zone, unsigned int order)
"pgsteal_direct",
"pgdemote_kswapd",
"pgdemote_direct",
+ "pgdemote_file",
"pgscan_kswapd",
"pgscan_direct",
"pgscan_direct_throttle",
--
1.8.3.1