diff mbox series

[v4,06/13] mm/huge pud: Use transparent huge pud helpers only with CONFIG_TRANSPARENT_HUGEPAGE

Message ID 20230710160842.56300-7-aneesh.kumar@linux.ibm.com (mailing list archive)
State New
Headers show
Series Add support for DAX vmemmap optimization for ppc64 | expand

Commit Message

Aneesh Kumar K.V July 10, 2023, 4:08 p.m. UTC
pudp_set_wrprotect and move_huge_pud helpers are only used when
CONFIG_TRANSPARENT_HUGEPAGE is enabled. Similar to pmdp_set_wrprotect and
move_huge_pmd_helpers use architecture override only if
CONFIG_TRANSPARENT_HUGEPAGE is set

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 include/linux/pgtable.h | 2 ++
 mm/mremap.c             | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Christophe Leroy July 10, 2023, 5:30 p.m. UTC | #1
Le 10/07/2023 à 18:08, Aneesh Kumar K.V a écrit :
> pudp_set_wrprotect and move_huge_pud helpers are only used when
> CONFIG_TRANSPARENT_HUGEPAGE is enabled. Similar to pmdp_set_wrprotect and
> move_huge_pmd_helpers use architecture override only if
> CONFIG_TRANSPARENT_HUGEPAGE is set
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>

> ---
>   include/linux/pgtable.h | 2 ++
>   mm/mremap.c             | 2 +-
>   2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
> index 91def34f7784..b5af3e014606 100644
> --- a/include/linux/pgtable.h
> +++ b/include/linux/pgtable.h
> @@ -558,6 +558,7 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm,
>   #endif
>   #ifndef __HAVE_ARCH_PUDP_SET_WRPROTECT
>   #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
>   static inline void pudp_set_wrprotect(struct mm_struct *mm,
>   				      unsigned long address, pud_t *pudp)
>   {
> @@ -571,6 +572,7 @@ static inline void pudp_set_wrprotect(struct mm_struct *mm,
>   {
>   	BUILD_BUG();
>   }
> +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
>   #endif /* CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */
>   #endif
>   
> diff --git a/mm/mremap.c b/mm/mremap.c
> index 11e06e4ab33b..056478c106ee 100644
> --- a/mm/mremap.c
> +++ b/mm/mremap.c
> @@ -349,7 +349,7 @@ static inline bool move_normal_pud(struct vm_area_struct *vma,
>   }
>   #endif
>   
> -#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
> +#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)
>   static bool move_huge_pud(struct vm_area_struct *vma, unsigned long old_addr,
>   			  unsigned long new_addr, pud_t *old_pud, pud_t *new_pud)
>   {
diff mbox series

Patch

diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index 91def34f7784..b5af3e014606 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -558,6 +558,7 @@  static inline void pmdp_set_wrprotect(struct mm_struct *mm,
 #endif
 #ifndef __HAVE_ARCH_PUDP_SET_WRPROTECT
 #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
 static inline void pudp_set_wrprotect(struct mm_struct *mm,
 				      unsigned long address, pud_t *pudp)
 {
@@ -571,6 +572,7 @@  static inline void pudp_set_wrprotect(struct mm_struct *mm,
 {
 	BUILD_BUG();
 }
+#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
 #endif /* CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */
 #endif
 
diff --git a/mm/mremap.c b/mm/mremap.c
index 11e06e4ab33b..056478c106ee 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -349,7 +349,7 @@  static inline bool move_normal_pud(struct vm_area_struct *vma,
 }
 #endif
 
-#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
+#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)
 static bool move_huge_pud(struct vm_area_struct *vma, unsigned long old_addr,
 			  unsigned long new_addr, pud_t *old_pud, pud_t *new_pud)
 {