summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2016-03-17 17:18:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-17 18:09:34 -0400
commitf9719a03de51e13526d614e79d002f838770b2d6 (patch)
tree696f6164980d678f6ac8c9f796508bf7c9c778fa
parent0a6b76dd23fa08c5fd7b68acdb55018a37afd4aa (diff)
thp, vmstats: count deferred split events
Count how many times we put a THP in split queue. Currently, it happens on partial unmap of a THP. Rapidly growing value can indicate that an application behaves unfriendly wrt THP: often fault in huge page and then unmap part of it. This leads to unnecessary memory fragmentation and the application may require tuning. The event also can help with debugging kernel [mis-]behaviour. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--Documentation/vm/transhuge.txt5
-rw-r--r--include/linux/vm_event_item.h1
-rw-r--r--mm/huge_memory.c1
-rw-r--r--mm/vmstat.c1
4 files changed, 8 insertions, 0 deletions
diff --git a/Documentation/vm/transhuge.txt b/Documentation/vm/transhuge.txt
index 21cf34f3ddb2..0dc8632aa01e 100644
--- a/Documentation/vm/transhuge.txt
+++ b/Documentation/vm/transhuge.txt
@@ -229,6 +229,11 @@ thp_split_page is incremented every time a huge page is split into base
229thp_split_page_failed is is incremented if kernel fails to split huge 229thp_split_page_failed is is incremented if kernel fails to split huge
230 page. This can happen if the page was pinned by somebody. 230 page. This can happen if the page was pinned by somebody.
231 231
232thp_deferred_split_page is incremented when a huge page is put onto split
233 queue. This happens when a huge page is partially unmapped and
234 splitting it would free up some memory. Pages on split queue are
235 going to be split under memory pressure.
236
232thp_split_pmd is incremented every time a PMD split into table of PTEs. 237thp_split_pmd is incremented every time a PMD split into table of PTEs.
233 This can happen, for instance, when application calls mprotect() or 238 This can happen, for instance, when application calls mprotect() or
234 munmap() on part of huge page. It doesn't split huge page, only 239 munmap() on part of huge page. It doesn't split huge page, only
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 58ecc056ee45..ec084321fe09 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -72,6 +72,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
72 THP_COLLAPSE_ALLOC_FAILED, 72 THP_COLLAPSE_ALLOC_FAILED,
73 THP_SPLIT_PAGE, 73 THP_SPLIT_PAGE,
74 THP_SPLIT_PAGE_FAILED, 74 THP_SPLIT_PAGE_FAILED,
75 THP_DEFERRED_SPLIT_PAGE,
75 THP_SPLIT_PMD, 76 THP_SPLIT_PMD,
76 THP_ZERO_PAGE_ALLOC, 77 THP_ZERO_PAGE_ALLOC,
77 THP_ZERO_PAGE_ALLOC_FAILED, 78 THP_ZERO_PAGE_ALLOC_FAILED,
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 1ea21e203a70..1dddfb21fc22 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3455,6 +3455,7 @@ void deferred_split_huge_page(struct page *page)
3455 3455
3456 spin_lock_irqsave(&pgdata->split_queue_lock, flags); 3456 spin_lock_irqsave(&pgdata->split_queue_lock, flags);
3457 if (list_empty(page_deferred_list(page))) { 3457 if (list_empty(page_deferred_list(page))) {
3458 count_vm_event(THP_DEFERRED_SPLIT_PAGE);
3458 list_add_tail(page_deferred_list(page), &pgdata->split_queue); 3459 list_add_tail(page_deferred_list(page), &pgdata->split_queue);
3459 pgdata->split_queue_len++; 3460 pgdata->split_queue_len++;
3460 } 3461 }
diff --git a/mm/vmstat.c b/mm/vmstat.c
index f80066248c94..5e4300482897 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -848,6 +848,7 @@ const char * const vmstat_text[] = {
848 "thp_collapse_alloc_failed", 848 "thp_collapse_alloc_failed",
849 "thp_split_page", 849 "thp_split_page",
850 "thp_split_page_failed", 850 "thp_split_page_failed",
851 "thp_deferred_split_page",
851 "thp_split_pmd", 852 "thp_split_pmd",
852 "thp_zero_page_alloc", 853 "thp_zero_page_alloc",
853 "thp_zero_page_alloc_failed", 854 "thp_zero_page_alloc_failed",