diff mbox series

[10/19] mm/vmscan: Optimise shrink_page_list for smaller THPs

Message ID 20201029193405.29125-11-willy@infradead.org
State New
Headers show
Series Transparent Hugepages for non-tmpfs filesystems | expand

Commit Message

Matthew Wilcox (Oracle) Oct. 29, 2020, 7:33 p.m. UTC
A THP which is smaller than a PMD does not need to do the extra work
in try_to_unmap() of trying to split a PMD entry.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/vmscan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 1c2e6ca92a45..9e140d19611a 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1300,7 +1300,8 @@  static unsigned int shrink_page_list(struct list_head *page_list,
 			enum ttu_flags flags = ttu_flags | TTU_BATCH_FLUSH;
 			bool was_swapbacked = PageSwapBacked(page);
 
-			if (unlikely(PageTransHuge(page)))
+			if (PageTransHuge(page) &&
+					thp_order(page) >= HPAGE_PMD_ORDER)
 				flags |= TTU_SPLIT_HUGE_PMD;
 
 			if (!try_to_unmap(page, flags)) {