diff mbox series

hugetlb: Remove PageHeadHuge()

Message ID 20230327151050.1787744-1-willy@infradead.org (mailing list archive)
State New
Headers show
Series hugetlb: Remove PageHeadHuge() | expand

Commit Message

Matthew Wilcox (Oracle) March 27, 2023, 3:10 p.m. UTC
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().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/page-flags.h |  7 +------
 mm/hugetlb.c               | 18 +++++++++++-------
 2 files changed, 12 insertions(+), 13 deletions(-)

Comments

Sidhartha Kumar March 27, 2023, 4:48 p.m. UTC | #1
On 3/27/23 8:10 AM, Matthew Wilcox (Oracle) wrote:
> 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().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>   include/linux/page-flags.h |  7 +------
>   mm/hugetlb.c               | 18 +++++++++++-------
>   2 files changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index 6b3e138613e1..88600a94fa91 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -811,14 +811,9 @@ static inline void ClearPageCompound(struct page *page)
>   
>   #ifdef CONFIG_HUGETLB_PAGE
>   int PageHuge(struct page *page);
> -int PageHeadHuge(struct page *page);
> -static inline bool folio_test_hugetlb(struct folio *folio)
> -{
> -	return PageHeadHuge(&folio->page);
> -}
> +bool folio_test_hugetlb(struct folio *folio);
>   #else
>   TESTPAGEFLAG_FALSE(Huge, hugetlb)
> -TESTPAGEFLAG_FALSE(HeadHuge, headhuge)
>   #endif
>   
>   #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 4dd722c35a7f..ff686074c481 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -2050,19 +2050,23 @@ int PageHuge(struct page *page)
>   }
>   EXPORT_SYMBOL_GPL(PageHuge);
>   
> -/*
> - * PageHeadHuge() only returns true for hugetlbfs head page, but not for
> - * normal or transparent huge pages.
> +/**
> + * folio_test_hugetlb - Determine if the folio belongs to hugetlbfs
> + * @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))
> -		return 0;
> +		return false;
>   
>   	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.
Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Mike Kravetz March 27, 2023, 6:01 p.m. UTC | #2
On 03/27/23 16:10, Matthew Wilcox (Oracle) wrote:
> 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().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>  include/linux/page-flags.h |  7 +------
>  mm/hugetlb.c               | 18 +++++++++++-------
>  2 files changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index 6b3e138613e1..88600a94fa91 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h

Thanks!

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
David Hildenbrand March 27, 2023, 8:51 p.m. UTC | #3
On 27.03.23 17:10, Matthew Wilcox (Oracle) wrote:
> 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().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---

Reviewed-by: David Hildenbrand <david@redhat.com>
Muchun Song March 28, 2023, 12:22 a.m. UTC | #4
> On Mar 27, 2023, at 23:10, Matthew Wilcox (Oracle) <willy@infradead.org> wrote:
> 
> 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().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

Thanks.
diff mbox series

Patch

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 6b3e138613e1..88600a94fa91 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -811,14 +811,9 @@  static inline void ClearPageCompound(struct page *page)
 
 #ifdef CONFIG_HUGETLB_PAGE
 int PageHuge(struct page *page);
-int PageHeadHuge(struct page *page);
-static inline bool folio_test_hugetlb(struct folio *folio)
-{
-	return PageHeadHuge(&folio->page);
-}
+bool folio_test_hugetlb(struct folio *folio);
 #else
 TESTPAGEFLAG_FALSE(Huge, hugetlb)
-TESTPAGEFLAG_FALSE(HeadHuge, headhuge)
 #endif
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 4dd722c35a7f..ff686074c481 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2050,19 +2050,23 @@  int PageHuge(struct page *page)
 }
 EXPORT_SYMBOL_GPL(PageHuge);
 
-/*
- * PageHeadHuge() only returns true for hugetlbfs head page, but not for
- * normal or transparent huge pages.
+/**
+ * folio_test_hugetlb - Determine if the folio belongs to hugetlbfs
+ * @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))
-		return 0;
+		return false;
 
 	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.