[RFC PATCH v2 15/30] mm: thp: add PUD THP to deferred split list when PUD mapping is gone.

From: Zi Yan
Date: Mon Sep 28 2020 - 14:02:12 EST


From: Zi Yan <ziy@xxxxxxxxxx>

When PUD mapping is gone, there is no need to keep the PUD THP. Add it
to deferred split list, so when memory pressure comes, the THP will be
split.

Signed-off-by: Zi Yan <ziy@xxxxxxxxxx>
---
mm/rmap.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/mm/rmap.c b/mm/rmap.c
index b4950f7a0978..424322807966 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1329,6 +1329,9 @@ static void page_remove_anon_compound_rmap(struct page *page, int map_order)
}
__dec_node_page_state(page, NR_ANON_THPS);
}
+ /* deferred split huge pud page if PUD map is gone */
+ if (!compound_mapcount(head))
+ deferred_split_huge_page(head);
nr += HPAGE_PMD_NR;
__mod_node_page_state(page_pgdat(head), NR_ANON_MAPPED, -nr);
return;
--
2.28.0