From: Kaiyang Zhao <kaiyang2@xxxxxxxxxx> Add a counter for the number of pages migrated across zones in vmstat Signed-off-by: Kaiyang Zhao <zh_kaiyang@xxxxxxxxxxx> --- include/linux/vm_event_item.h | 1 + mm/compaction.c | 2 ++ mm/vmstat.c | 1 + 3 files changed, 4 insertions(+) diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index 8abfa1240040..be88819085b6 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h @@ -79,6 +79,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, COMPACTSTALL, COMPACTFAIL, COMPACTSUCCESS, KCOMPACTD_WAKE, KCOMPACTD_MIGRATE_SCANNED, KCOMPACTD_FREE_SCANNED, + COMPACT_CROSS_ZONE_MIGRATED, #endif #ifdef CONFIG_HUGETLB_PAGE HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, diff --git a/mm/compaction.c b/mm/compaction.c index 03b5c4debc17..dea10ad8ec64 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2552,6 +2552,8 @@ compact_zone(struct compact_control *cc, struct capture_control *capc) count_compact_events(COMPACTMIGRATE_SCANNED, cc->total_migrate_scanned); count_compact_events(COMPACTFREE_SCANNED, cc->total_free_scanned); + if (dst_zone != cc->zone) + count_compact_events(COMPACT_CROSS_ZONE_MIGRATED, nr_succeeded); trace_mm_compaction_end(cc, start_pfn, end_pfn, sync, ret); diff --git a/mm/vmstat.c b/mm/vmstat.c index c28046371b45..98af82e65ad9 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1324,6 +1324,7 @@ const char * const vmstat_text[] = { "compact_daemon_wake", "compact_daemon_migrate_scanned", "compact_daemon_free_scanned", + "compact_cross_zone_migrated", #endif #ifdef CONFIG_HUGETLB_PAGE -- 2.40.1