2022-10-21 16:51:38

by James Houghton

[permalink] [raw]
Subject: [RFC PATCH v2 02/47] hugetlb: remove mk_huge_pte; it is unused

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 <[email protected]>
---
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


2022-11-16 17:19:03

by Peter Xu

[permalink] [raw]
Subject: Re: [RFC PATCH v2 02/47] hugetlb: remove mk_huge_pte; it is unused

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 <[email protected]>

Acked-by: Peter Xu <[email protected]>

--
Peter Xu


2022-12-07 23:29:07

by Mina Almasry

[permalink] [raw]
Subject: Re: [RFC PATCH v2 02/47] hugetlb: remove mk_huge_pte; it is unused

On Fri, Oct 21, 2022 at 9:37 AM James Houghton <[email protected]> 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 <[email protected]>

Acked-by: Mina Almasry <[email protected]>

> ---
> 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
>

2022-12-09 00:00:06

by Mike Kravetz

[permalink] [raw]
Subject: Re: [RFC PATCH v2 02/47] hugetlb: remove mk_huge_pte; it is unused

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 <[email protected]>
> ---
> 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 <[email protected]>
--
Mike Kravetz