diff mbox series

[RFC,v2,02/47] hugetlb: remove mk_huge_pte; it is unused

Message ID 20221021163703.3218176-3-jthoughton@google.com (mailing list archive)
State New
Headers show
Series hugetlb: introduce HugeTLB high-granularity mapping | expand

Commit Message

James Houghton Oct. 21, 2022, 4:36 p.m. UTC
mk_huge_pte is unused and not necessary. pte_mkhuge is the appropriate
function to call to create a HugeTLB PTE (see
Documentation/mm/arch_pgtable_helpers.rst).

It is being removed now to avoid complicating the implementation of
HugeTLB high-granularity mapping.

Signed-off-by: James Houghton <jthoughton@google.com>
---
 arch/s390/include/asm/hugetlb.h | 5 -----
 include/asm-generic/hugetlb.h   | 5 -----
 mm/debug_vm_pgtable.c           | 2 +-
 mm/hugetlb.c                    | 7 +++----
 4 files changed, 4 insertions(+), 15 deletions(-)

Comments

Peter Xu Nov. 16, 2022, 4:35 p.m. UTC | #1
On Fri, Oct 21, 2022 at 04:36:18PM +0000, James Houghton wrote:
> mk_huge_pte is unused and not necessary. pte_mkhuge is the appropriate
> function to call to create a HugeTLB PTE (see
> Documentation/mm/arch_pgtable_helpers.rst).
> 
> It is being removed now to avoid complicating the implementation of
> HugeTLB high-granularity mapping.
> 
> Signed-off-by: James Houghton <jthoughton@google.com>

Acked-by: Peter Xu <peterx@redhat.com>
Mina Almasry Dec. 7, 2022, 11:13 p.m. UTC | #2
On Fri, Oct 21, 2022 at 9:37 AM James Houghton <jthoughton@google.com> wrote:
>
> mk_huge_pte is unused and not necessary. pte_mkhuge is the appropriate
> function to call to create a HugeTLB PTE (see
> Documentation/mm/arch_pgtable_helpers.rst).
>
> It is being removed now to avoid complicating the implementation of
> HugeTLB high-granularity mapping.
>
> Signed-off-by: James Houghton <jthoughton@google.com>

Acked-by: Mina Almasry <almasrymina@google.com>

> ---
>  arch/s390/include/asm/hugetlb.h | 5 -----
>  include/asm-generic/hugetlb.h   | 5 -----
>  mm/debug_vm_pgtable.c           | 2 +-
>  mm/hugetlb.c                    | 7 +++----
>  4 files changed, 4 insertions(+), 15 deletions(-)
>
> diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h
> index ccdbccfde148..c34893719715 100644
> --- a/arch/s390/include/asm/hugetlb.h
> +++ b/arch/s390/include/asm/hugetlb.h
> @@ -77,11 +77,6 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
>         set_huge_pte_at(mm, addr, ptep, pte_wrprotect(pte));
>  }
>
> -static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot)
> -{
> -       return mk_pte(page, pgprot);
> -}
> -
>  static inline int huge_pte_none(pte_t pte)
>  {
>         return pte_none(pte);
> diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h
> index a57d667addd2..aab9e46fa628 100644
> --- a/include/asm-generic/hugetlb.h
> +++ b/include/asm-generic/hugetlb.h
> @@ -5,11 +5,6 @@
>  #include <linux/swap.h>
>  #include <linux/swapops.h>
>
> -static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot)
> -{
> -       return mk_pte(page, pgprot);
> -}
> -
>  static inline unsigned long huge_pte_write(pte_t pte)
>  {
>         return pte_write(pte);
> diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
> index 2b61fde8c38c..10573a283a12 100644
> --- a/mm/debug_vm_pgtable.c
> +++ b/mm/debug_vm_pgtable.c
> @@ -929,7 +929,7 @@ static void __init hugetlb_basic_tests(struct pgtable_debug_args *args)
>          * as it was previously derived from a real kernel symbol.
>          */
>         page = pfn_to_page(args->fixed_pmd_pfn);
> -       pte = mk_huge_pte(page, args->page_prot);
> +       pte = mk_pte(page, args->page_prot);
>
>         WARN_ON(!huge_pte_dirty(huge_pte_mkdirty(pte)));
>         WARN_ON(!huge_pte_write(huge_pte_mkwrite(huge_pte_wrprotect(pte))));
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 650761cdd2f6..20a111b532aa 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -4728,11 +4728,10 @@ static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,
>         unsigned int shift = huge_page_shift(hstate_vma(vma));
>
>         if (writable) {
> -               entry = huge_pte_mkwrite(huge_pte_mkdirty(mk_huge_pte(page,
> -                                        vma->vm_page_prot)));
> +               entry = huge_pte_mkwrite(huge_pte_mkdirty(mk_pte(page,
> +                                               vma->vm_page_prot)));
>         } else {
> -               entry = huge_pte_wrprotect(mk_huge_pte(page,
> -                                          vma->vm_page_prot));
> +               entry = huge_pte_wrprotect(mk_pte(page, vma->vm_page_prot));
>         }
>         entry = pte_mkyoung(entry);
>         entry = arch_make_huge_pte(entry, shift, vma->vm_flags);
> --
> 2.38.0.135.g90850a2211-goog
>
Mike Kravetz Dec. 8, 2022, 11:42 p.m. UTC | #3
On 10/21/22 16:36, James Houghton wrote:
> mk_huge_pte is unused and not necessary. pte_mkhuge is the appropriate
> function to call to create a HugeTLB PTE (see
> Documentation/mm/arch_pgtable_helpers.rst).
> 
> It is being removed now to avoid complicating the implementation of
> HugeTLB high-granularity mapping.
> 
> Signed-off-by: James Houghton <jthoughton@google.com>
> ---
>  arch/s390/include/asm/hugetlb.h | 5 -----
>  include/asm-generic/hugetlb.h   | 5 -----
>  mm/debug_vm_pgtable.c           | 2 +-
>  mm/hugetlb.c                    | 7 +++----
>  4 files changed, 4 insertions(+), 15 deletions(-)

Thanks!

I suspect there is more cleanup of 'hugetlb page table helpers' that
could be done.

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
diff mbox series

Patch

diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h
index ccdbccfde148..c34893719715 100644
--- a/arch/s390/include/asm/hugetlb.h
+++ b/arch/s390/include/asm/hugetlb.h
@@ -77,11 +77,6 @@  static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
 	set_huge_pte_at(mm, addr, ptep, pte_wrprotect(pte));
 }
 
-static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot)
-{
-	return mk_pte(page, pgprot);
-}
-
 static inline int huge_pte_none(pte_t pte)
 {
 	return pte_none(pte);
diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h
index a57d667addd2..aab9e46fa628 100644
--- a/include/asm-generic/hugetlb.h
+++ b/include/asm-generic/hugetlb.h
@@ -5,11 +5,6 @@ 
 #include <linux/swap.h>
 #include <linux/swapops.h>
 
-static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot)
-{
-	return mk_pte(page, pgprot);
-}
-
 static inline unsigned long huge_pte_write(pte_t pte)
 {
 	return pte_write(pte);
diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
index 2b61fde8c38c..10573a283a12 100644
--- a/mm/debug_vm_pgtable.c
+++ b/mm/debug_vm_pgtable.c
@@ -929,7 +929,7 @@  static void __init hugetlb_basic_tests(struct pgtable_debug_args *args)
 	 * as it was previously derived from a real kernel symbol.
 	 */
 	page = pfn_to_page(args->fixed_pmd_pfn);
-	pte = mk_huge_pte(page, args->page_prot);
+	pte = mk_pte(page, args->page_prot);
 
 	WARN_ON(!huge_pte_dirty(huge_pte_mkdirty(pte)));
 	WARN_ON(!huge_pte_write(huge_pte_mkwrite(huge_pte_wrprotect(pte))));
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 650761cdd2f6..20a111b532aa 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4728,11 +4728,10 @@  static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,
 	unsigned int shift = huge_page_shift(hstate_vma(vma));
 
 	if (writable) {
-		entry = huge_pte_mkwrite(huge_pte_mkdirty(mk_huge_pte(page,
-					 vma->vm_page_prot)));
+		entry = huge_pte_mkwrite(huge_pte_mkdirty(mk_pte(page,
+						vma->vm_page_prot)));
 	} else {
-		entry = huge_pte_wrprotect(mk_huge_pte(page,
-					   vma->vm_page_prot));
+		entry = huge_pte_wrprotect(mk_pte(page, vma->vm_page_prot));
 	}
 	entry = pte_mkyoung(entry);
 	entry = arch_make_huge_pte(entry, shift, vma->vm_flags);