From edd74f93c0d4f53293b02ed2b8b9502660dfafc4 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 20 Jul 2024 12:50:20 +0000 Subject: [PATCH] Revert "mm/hugetlb: add hugetlb_folio_subpool() helpers" This reverts commit 6a8af731a16e134453614d71cc9be720608ef46e which is commit 149562f7509404c382c32c3fa8a6ba356135e5cf 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: I2987d07bc7063ecb38b8565a2dbd943fdf251aa2 Signed-off-by: Greg Kroah-Hartman --- fs/hugetlbfs/inode.c | 8 ++++---- include/linux/hugetlb.h | 15 ++------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index a650f39f8ce7..661999ab147e 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1108,10 +1108,10 @@ static int hugetlbfs_migrate_folio(struct address_space *mapping, if (rc != MIGRATEPAGE_SUCCESS) return rc; - if (hugetlb_folio_subpool(src)) { - hugetlb_set_folio_subpool(dst, - hugetlb_folio_subpool(src)); - hugetlb_set_folio_subpool(src, NULL); + if (hugetlb_page_subpool(&src->page)) { + hugetlb_set_page_subpool(&dst->page, + hugetlb_page_subpool(&src->page)); + hugetlb_set_page_subpool(&src->page, NULL); } if (mode != MIGRATE_SYNC_NO_COPY) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 02d9a8af3704..0c5326fd3c47 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -754,29 +754,18 @@ extern unsigned int default_hstate_idx; #define default_hstate (hstates[default_hstate_idx]) -static inline struct hugepage_subpool *hugetlb_folio_subpool(struct folio *folio) -{ - return (void *)folio_get_private_1(folio); -} - /* * hugetlb page subpool pointer located in hpage[1].private */ static inline struct hugepage_subpool *hugetlb_page_subpool(struct page *hpage) { - return hugetlb_folio_subpool(page_folio(hpage)); -} - -static inline void hugetlb_set_folio_subpool(struct folio *folio, - struct hugepage_subpool *subpool) -{ - folio_set_private_1(folio, (unsigned long)subpool); + return (void *)page_private(hpage + SUBPAGE_INDEX_SUBPOOL); } static inline void hugetlb_set_page_subpool(struct page *hpage, struct hugepage_subpool *subpool) { - hugetlb_set_folio_subpool(page_folio(hpage), subpool); + set_page_private(hpage + SUBPAGE_INDEX_SUBPOOL, (unsigned long)subpool); } static inline struct hstate *hstate_file(struct file *f)