From fe490cc0fe9e6ee48cc48bb5dc463bc5f0f1428f Mon Sep 17 00:00:00 2001 From: Huang Ying Date: Wed, 6 Sep 2017 16:22:52 -0700 Subject: mm, THP, swap: add THP swapping out fallback counting When swapping out THP (Transparent Huge Page), instead of swapping out the THP as a whole, sometimes we have to fallback to split the THP into normal pages before swapping, because no free swap clusters are available, or cgroup limit is exceeded, etc. To count the number of the fallback, a new VM event THP_SWPOUT_FALLBACK is added, and counted when we fallback to split the THP. Link: http://lkml.kernel.org/r/20170724051840.2309-13-ying.huang@intel.com Signed-off-by: "Huang, Ying" Cc: Johannes Weiner Cc: Minchan Kim Cc: Hugh Dickins Cc: Shaohua Li Cc: Rik van Riel Cc: Andrea Arcangeli Cc: "Kirill A . Shutemov" Cc: Michal Hocko Cc: Dan Williams Cc: Jens Axboe Cc: Ross Zwisler [for brd.c, zram_drv.c, pmem.c] Cc: Vishal L Verma Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/vmscan.c | 3 +++ mm/vmstat.c | 1 + 2 files changed, 4 insertions(+) (limited to 'mm') diff --git a/mm/vmscan.c b/mm/vmscan.c index 6fbf707c0ce2..13d711dd8776 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1154,6 +1154,9 @@ static unsigned long shrink_page_list(struct list_head *page_list, if (split_huge_page_to_list(page, page_list)) goto activate_locked; +#ifdef CONFIG_TRANSPARENT_HUGEPAGE + count_vm_event(THP_SWPOUT_FALLBACK); +#endif if (!add_to_swap(page)) goto activate_locked; } diff --git a/mm/vmstat.c b/mm/vmstat.c index bccf426453cd..e131b51654c7 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1072,6 +1072,7 @@ const char * const vmstat_text[] = { "thp_zero_page_alloc", "thp_zero_page_alloc_failed", "thp_swpout", + "thp_swpout_fallback", #endif #ifdef CONFIG_MEMORY_BALLOON "balloon_inflate", -- cgit v1.2.3