From 366b3a6494b4636c2294164a0d946bdb282a4e34 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 20 Jul 2024 12:50:01 +0000 Subject: [PATCH] Revert "mm/hugetlb: add folio_hstate()" This reverts commit 6b27a1f2533ad24406778cf6513fda55fba83c89 which is commit e51da3a9b6c2f67879880259a25c51dbda01c462 upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: I431cd23e83455c445568dc8dd589915bdb6594c4 Signed-off-by: Greg Kroah-Hartman --- include/linux/hugetlb.h | 14 ++------------ mm/migrate.c | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 37eeef9841c4..02d9a8af3704 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -863,15 +863,10 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, } #endif -static inline struct hstate *folio_hstate(struct folio *folio) -{ - VM_BUG_ON_FOLIO(!folio_test_hugetlb(folio), folio); - return size_to_hstate(folio_size(folio)); -} - static inline struct hstate *page_hstate(struct page *page) { - return folio_hstate(page_folio(page)); + VM_BUG_ON_PAGE(!PageHuge(page), page); + return size_to_hstate(page_size(page)); } static inline unsigned hstate_index_to_shift(unsigned index) @@ -1082,11 +1077,6 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma) return NULL; } -static inline struct hstate *folio_hstate(struct folio *folio) -{ - return NULL; -} - static inline struct hstate *page_hstate(struct page *page) { return NULL; diff --git a/mm/migrate.c b/mm/migrate.c index 2c288246c0be..954c04f28eb9 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1640,7 +1640,7 @@ struct page *alloc_migration_target(struct page *page, unsigned long private) nid = folio_nid(folio); if (folio_test_hugetlb(folio)) { - struct hstate *h = folio_hstate(folio); + struct hstate *h = page_hstate(&folio->page); gfp_mask = htlb_modify_alloc_mask(h, gfp_mask); return alloc_huge_page_nodemask(h, nid, mtc->nmask, gfp_mask);