]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
mm, THP, swap: add THP swapping out fallback counting
authorHuang Ying <ying.huang@intel.com>
Wed, 6 Sep 2017 23:22:52 +0000 (16:22 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 7 Sep 2017 00:27:28 +0000 (17:27 -0700)
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" <ying.huang@intel.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Shaohua Li <shli@kernel.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Ross Zwisler <ross.zwisler@intel.com> [for brd.c, zram_drv.c, pmem.c]
Cc: Vishal L Verma <vishal.l.verma@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/vm_event_item.h
mm/vmscan.c
mm/vmstat.c

index c75024e80eed46d7f2db77a49e662be467dc3ff8..e02820fc2861a9017f223d0f1da134ebe9aaa13b 100644 (file)
@@ -86,6 +86,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
                THP_ZERO_PAGE_ALLOC,
                THP_ZERO_PAGE_ALLOC_FAILED,
                THP_SWPOUT,
+               THP_SWPOUT_FALLBACK,
 #endif
 #ifdef CONFIG_MEMORY_BALLOON
                BALLOON_INFLATE,
index 6fbf707c0ce2c6a2ac73c1fc273676691d8e5725..13d711dd87766a71a653c2c9e3efcba80fef3314 100644 (file)
@@ -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;
                                }
index bccf426453cdfce078055a37363bf688bd556122..e131b51654c79e6a2345e55251f0cfeeeddf365d 100644 (file)
@@ -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",