diff --git a/include/linux/dynamic_hugetlb.h b/include/linux/dynamic_hugetlb.h index eff31669e2108976413bb1f59cb254f1360b23c2..06b20a24dfe65ee4521f55f9f2fb0bc6c3bfa9e4 100644 --- a/include/linux/dynamic_hugetlb.h +++ b/include/linux/dynamic_hugetlb.h @@ -184,12 +184,12 @@ static inline void free_huge_page_to_dhugetlb_pool(struct page *page, bool restore_reserve) { } +#endif + static inline bool page_belong_to_dynamic_hugetlb(struct page *page) { return false; } -#endif - #endif /* CONFIG_DYNAMIC_HUGETLB */ #endif /* __LINUX_DYNAMIC_HUGETLB_H */ diff --git a/mm/compaction.c b/mm/compaction.c index bdcde6ea7f97eb572bf87b1bf12ba0d79868dfc4..754734a649d5c7c3195ae197571b25eedc90b644 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "internal.h" #ifdef CONFIG_COMPACTION @@ -1862,6 +1863,9 @@ static isolate_migrate_t isolate_migratepages(struct compact_control *cc) if (!page) continue; + if (page_belong_to_dynamic_hugetlb(page)) + continue; + /* * If isolation recently failed, do not retry. Only check the * pageblock once. COMPACT_CLUSTER_MAX causes a pageblock diff --git a/mm/migrate.c b/mm/migrate.c index 9d40b1264a8b77b81d9610acd25ec305c2fc808f..c8491a744e8c3ce755f289eadda527194eb3bd36 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -49,6 +49,7 @@ #include #include #include +#include #include @@ -1611,6 +1612,9 @@ struct page *alloc_migration_target(struct page *page, unsigned long private) if (PageHuge(page)) { struct hstate *h = page_hstate(compound_head(page)); + if (page_belong_to_dynamic_hugetlb(page)) + return NULL; + gfp_mask = htlb_modify_alloc_mask(h, gfp_mask); return alloc_huge_page_nodemask(h, nid, mtc->nmask, gfp_mask); } @@ -2088,6 +2092,9 @@ static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page) if (!migrate_balanced_pgdat(pgdat, compound_nr(page))) return 0; + if (page_belong_to_dynamic_hugetlb(page)) + return 0; + if (isolate_lru_page(page)) return 0; diff --git a/mm/page_isolation.c b/mm/page_isolation.c index bddf788f45bff8cb2f1768dc3930a24355566658..48a0ee9cef0ac21e7f4c8a5f2358a3d0adfcab03 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "internal.h" #define CREATE_TRACE_POINTS @@ -195,7 +196,8 @@ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, pfn += pageblock_nr_pages) { page = __first_valid_page(pfn, pageblock_nr_pages); if (page) { - if (set_migratetype_isolate(page, migratetype, flags)) { + if (page_belong_to_dynamic_hugetlb(page) || + set_migratetype_isolate(page, migratetype, flags)) { undo_pfn = pfn; goto undo; }