Commit 957ebbdf authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

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/20230327151050.1787744-1-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarSidhartha Kumar <sidhartha.kumar@oracle.com>
Reviewed-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Reviewed-by: default avatarMuchun Song <songmuchun@bytedance.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 4519a254
...@@ -815,14 +815,9 @@ static inline void ClearPageCompound(struct page *page) ...@@ -815,14 +815,9 @@ static inline void ClearPageCompound(struct page *page)
#ifdef CONFIG_HUGETLB_PAGE #ifdef CONFIG_HUGETLB_PAGE
int PageHuge(struct page *page); int PageHuge(struct page *page);
int PageHeadHuge(struct page *page); bool folio_test_hugetlb(struct folio *folio);
static inline bool folio_test_hugetlb(struct folio *folio)
{
return PageHeadHuge(&folio->page);
}
#else #else
TESTPAGEFLAG_FALSE(Huge, hugetlb) TESTPAGEFLAG_FALSE(Huge, hugetlb)
TESTPAGEFLAG_FALSE(HeadHuge, headhuge)
#endif #endif
#ifdef CONFIG_TRANSPARENT_HUGEPAGE #ifdef CONFIG_TRANSPARENT_HUGEPAGE
......
...@@ -2050,19 +2050,23 @@ int PageHuge(struct page *page) ...@@ -2050,19 +2050,23 @@ int PageHuge(struct page *page)
} }
EXPORT_SYMBOL_GPL(PageHuge); EXPORT_SYMBOL_GPL(PageHuge);
/* /**
* PageHeadHuge() only returns true for hugetlbfs head page, but not for * folio_test_hugetlb - Determine if the folio belongs to hugetlbfs
* normal or transparent huge pages. * @folio: The folio to test.
*
* Context: Any context. Caller should have a reference on the folio to
* prevent it from being turned into a tail page.
* Return: True for hugetlbfs folios, false for anon folios or folios
* belonging to other filesystems.
*/ */
int PageHeadHuge(struct page *page_head) bool folio_test_hugetlb(struct folio *folio)
{ {
struct folio *folio = (struct folio *)page_head;
if (!folio_test_large(folio)) if (!folio_test_large(folio))
return 0; return false;
return folio->_folio_dtor == HUGETLB_PAGE_DTOR; return folio->_folio_dtor == HUGETLB_PAGE_DTOR;
} }
EXPORT_SYMBOL_GPL(PageHeadHuge); EXPORT_SYMBOL_GPL(folio_test_hugetlb);
/* /*
* Find and lock address space (mapping) in write mode. * Find and lock address space (mapping) in write mode.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment