ANBZ: #80
Add page promotion throttle statistic, which can be used to check
how many cold pages were trying to be prmoted to DRAM, and help
to tuning the latency threhold.
Signed-off-by: Baolin Wang <baolin.wang(a)linux.alibaba.com>
---
include/linux/mmzone.h | 1 +
kernel/sched/fair.c | 5 ++++-
mm/vmstat.c | 1 +
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index d03a536..eecffa7 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -213,6 +213,7 @@ enum node_stat_item {
PGPROMOTE_FILE,
PGPROMOTE_TRY, /* pages to try to migrate via NUMA balancing */
PGDEMOTED_HOT,
+ PGPROMOTE_COLD_THROTTLE,
#endif
NR_VM_NODE_STAT_ITEMS
};
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index c473da4..0a11b03 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3021,8 +3021,11 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page
* page,
if (flags & TNF_WRITE)
th *= 2;
latency = numa_hint_fault_latency(page);
- if (latency > th)
+ if (latency > th) {
+ mod_node_page_state(pgdat, PGPROMOTE_COLD_THROTTLE,
+ hpage_nr_pages(page));
return false;
+ }
if (flags & TNF_DEMOTED)
mod_node_page_state(pgdat, PGDEMOTED_HOT,
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 7f2c498..98f2a03 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1193,6 +1193,7 @@ int fragmentation_index(struct zone *zone, unsigned int order)
"pgpromote_file",
"pgpromote_try",
"pgpromote_demoted",
+ "pgpromote_cold_throttle",
#endif
/* enum writeback_stat_item counters */
--
1.8.3.1