linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: remove set_compound_page_dtor()
@ 2023-06-12 16:34 Sidhartha Kumar
  2023-06-12 17:28 ` Tarun Sahu
  0 siblings, 1 reply; 2+ messages in thread
From: Sidhartha Kumar @ 2023-06-12 16:34 UTC (permalink / raw)
  To: linux-kernel, linux-mm; +Cc: akpm, willy, tsahu, aneesh.kumar, Sidhartha Kumar

All users can use the folio equivalent so this function can be safely
removed.

Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
---

rebased on 06/12/23 mm-unstable + Tarun's patch[1]
[1]: https://lore.kernel.org/linux-mm/20230612093514.689846-1-tsahu@linux.ibm.com/

 include/linux/mm.h | 10 ----------
 mm/huge_memory.c   |  2 +-
 mm/internal.h      |  2 +-
 3 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 4a1aec5e4b83c..485224cd62ffb 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1223,16 +1223,6 @@ enum compound_dtor_id {
 };
 extern compound_page_dtor * const compound_page_dtors[NR_COMPOUND_DTORS];
 
-static inline void set_compound_page_dtor(struct page *page,
-		enum compound_dtor_id compound_dtor)
-{
-	struct folio *folio = (struct folio *)page;
-
-	VM_BUG_ON_PAGE(compound_dtor >= NR_COMPOUND_DTORS, page);
-	VM_BUG_ON_PAGE(!PageHead(page), page);
-	folio->_folio_dtor = compound_dtor;
-}
-
 static inline void folio_set_compound_dtor(struct folio *folio,
 		enum compound_dtor_id compound_dtor)
 {
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 31bc8fa768e3d..76f970aa5b4da 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -583,7 +583,7 @@ void prep_transhuge_page(struct page *page)
 
 	VM_BUG_ON_FOLIO(folio_order(folio) < 2, folio);
 	INIT_LIST_HEAD(&folio->_deferred_list);
-	set_compound_page_dtor(page, TRANSHUGE_PAGE_DTOR);
+	folio_set_compound_dtor(folio, TRANSHUGE_PAGE_DTOR);
 }
 
 static inline bool is_transparent_hugepage(struct page *page)
diff --git a/mm/internal.h b/mm/internal.h
index 61acceface45f..a64967bfcd2ab 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -406,7 +406,7 @@ static inline void prep_compound_head(struct page *page, unsigned int order)
 {
 	struct folio *folio = (struct folio *)page;
 
-	set_compound_page_dtor(page, COMPOUND_PAGE_DTOR);
+	folio_set_compound_dtor(folio, COMPOUND_PAGE_DTOR);
 	folio_set_order(folio, order);
 	atomic_set(&folio->_entire_mapcount, -1);
 	atomic_set(&folio->_nr_pages_mapped, 0);
-- 
2.40.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm: remove set_compound_page_dtor()
  2023-06-12 16:34 [PATCH] mm: remove set_compound_page_dtor() Sidhartha Kumar
@ 2023-06-12 17:28 ` Tarun Sahu
  0 siblings, 0 replies; 2+ messages in thread
From: Tarun Sahu @ 2023-06-12 17:28 UTC (permalink / raw)
  To: Sidhartha Kumar, linux-kernel, linux-mm
  Cc: akpm, willy, aneesh.kumar, Sidhartha Kumar


LGTM;

Sidhartha Kumar <sidhartha.kumar@oracle.com> writes:

> All users can use the folio equivalent so this function can be safely
> removed.
>
> Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
> ---
>
> rebased on 06/12/23 mm-unstable + Tarun's patch[1]
> [1]: https://lore.kernel.org/linux-mm/20230612093514.689846-1-tsahu@linux.ibm.com/
>
>  include/linux/mm.h | 10 ----------
>  mm/huge_memory.c   |  2 +-
>  mm/internal.h      |  2 +-
>  3 files changed, 2 insertions(+), 12 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 4a1aec5e4b83c..485224cd62ffb 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1223,16 +1223,6 @@ enum compound_dtor_id {
>  };
>  extern compound_page_dtor * const compound_page_dtors[NR_COMPOUND_DTORS];
>  
> -static inline void set_compound_page_dtor(struct page *page,
> -		enum compound_dtor_id compound_dtor)
> -{
> -	struct folio *folio = (struct folio *)page;
> -
> -	VM_BUG_ON_PAGE(compound_dtor >= NR_COMPOUND_DTORS, page);
> -	VM_BUG_ON_PAGE(!PageHead(page), page);
> -	folio->_folio_dtor = compound_dtor;
> -}
> -
>  static inline void folio_set_compound_dtor(struct folio *folio,
>  		enum compound_dtor_id compound_dtor)
>  {
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 31bc8fa768e3d..76f970aa5b4da 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -583,7 +583,7 @@ void prep_transhuge_page(struct page *page)
>  
>  	VM_BUG_ON_FOLIO(folio_order(folio) < 2, folio);
>  	INIT_LIST_HEAD(&folio->_deferred_list);
> -	set_compound_page_dtor(page, TRANSHUGE_PAGE_DTOR);
> +	folio_set_compound_dtor(folio, TRANSHUGE_PAGE_DTOR);
>  }
>  
>  static inline bool is_transparent_hugepage(struct page *page)
> diff --git a/mm/internal.h b/mm/internal.h
> index 61acceface45f..a64967bfcd2ab 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -406,7 +406,7 @@ static inline void prep_compound_head(struct page *page, unsigned int order)
>  {
>  	struct folio *folio = (struct folio *)page;
>  
> -	set_compound_page_dtor(page, COMPOUND_PAGE_DTOR);
> +	folio_set_compound_dtor(folio, COMPOUND_PAGE_DTOR);
>  	folio_set_order(folio, order);
>  	atomic_set(&folio->_entire_mapcount, -1);
>  	atomic_set(&folio->_nr_pages_mapped, 0);

Reviewed-by: Tarun Sahu <tsahu@linux.ibm.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-12 17:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-12 16:34 [PATCH] mm: remove set_compound_page_dtor() Sidhartha Kumar
2023-06-12 17:28 ` Tarun Sahu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).