Skip to content

Commit 957ebbd

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
hugetlb: remove PageHeadHuge()
Sidhartha Kumar removed the last caller of PageHeadHuge(), so we can now remove it and make folio_test_hugetlb() the real implementation. Add kernel-doc for folio_test_hugetlb(). Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Sidhartha Kumar <[email protected]> Reviewed-by: Mike Kravetz <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Reviewed-by: Muchun Song <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 4519a25 commit 957ebbd

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

include/linux/page-flags.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -815,14 +815,9 @@ static inline void ClearPageCompound(struct page *page)
815815

816816
#ifdef CONFIG_HUGETLB_PAGE
817817
int PageHuge(struct page *page);
818-
int PageHeadHuge(struct page *page);
819-
static inline bool folio_test_hugetlb(struct folio *folio)
820-
{
821-
return PageHeadHuge(&folio->page);
822-
}
818+
bool folio_test_hugetlb(struct folio *folio);
823819
#else
824820
TESTPAGEFLAG_FALSE(Huge, hugetlb)
825-
TESTPAGEFLAG_FALSE(HeadHuge, headhuge)
826821
#endif
827822

828823
#ifdef CONFIG_TRANSPARENT_HUGEPAGE

mm/hugetlb.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,19 +2050,23 @@ int PageHuge(struct page *page)
20502050
}
20512051
EXPORT_SYMBOL_GPL(PageHuge);
20522052

2053-
/*
2054-
* PageHeadHuge() only returns true for hugetlbfs head page, but not for
2055-
* normal or transparent huge pages.
2053+
/**
2054+
* folio_test_hugetlb - Determine if the folio belongs to hugetlbfs
2055+
* @folio: The folio to test.
2056+
*
2057+
* Context: Any context. Caller should have a reference on the folio to
2058+
* prevent it from being turned into a tail page.
2059+
* Return: True for hugetlbfs folios, false for anon folios or folios
2060+
* belonging to other filesystems.
20562061
*/
2057-
int PageHeadHuge(struct page *page_head)
2062+
bool folio_test_hugetlb(struct folio *folio)
20582063
{
2059-
struct folio *folio = (struct folio *)page_head;
20602064
if (!folio_test_large(folio))
2061-
return 0;
2065+
return false;
20622066

20632067
return folio->_folio_dtor == HUGETLB_PAGE_DTOR;
20642068
}
2065-
EXPORT_SYMBOL_GPL(PageHeadHuge);
2069+
EXPORT_SYMBOL_GPL(folio_test_hugetlb);
20662070

20672071
/*
20682072
* Find and lock address space (mapping) in write mode.

0 commit comments

Comments
 (0)