All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02  5:38 ` Anshuman Khandual
  0 siblings, 0 replies; 24+ messages in thread
From: Anshuman Khandual @ 2022-02-02  5:38 UTC (permalink / raw)
  To: linux-mm
  Cc: Anshuman Khandual, Catalin Marinas, Will Deacon,
	Michael Ellerman, Paul Mackerras, David S. Miller, Mike Kravetz,
	Andrew Morton, linux-arm-kernel, linuxppc-dev, sparclinux,
	linux-kernel

Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
This updates generic fallback stub for arch_make_huge_pte() and available
platforms definitions. This makes huge pte creation much cleaner and easier
to follow.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: sparclinux@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/arm64/mm/hugetlbpage.c                      | 1 +
 arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
 arch/sparc/mm/hugetlbpage.c                      | 1 +
 include/linux/hugetlb.h                          | 2 +-
 mm/hugetlb.c                                     | 3 +--
 mm/vmalloc.c                                     | 1 -
 6 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index ffb9c229610a..228226c5fa80 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -347,6 +347,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
 {
 	size_t pagesize = 1UL << shift;
 
+	entry = pte_mkhuge(entry);
 	if (pagesize == CONT_PTE_SIZE) {
 		entry = pte_mkcont(entry);
 	} else if (pagesize == CONT_PMD_SIZE) {
diff --git a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
index 64b6c608eca4..e41e095158c7 100644
--- a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
+++ b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
@@ -70,6 +70,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags
 {
 	size_t size = 1UL << shift;
 
+	entry = pte_mkhuge(entry);
 	if (size == SZ_16K)
 		return __pte(pte_val(entry) & ~_PAGE_HUGE);
 	else
diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
index 0f49fada2093..d8e0e3c7038d 100644
--- a/arch/sparc/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
@@ -181,6 +181,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
 {
 	pte_t pte;
 
+	entry = pte_mkhuge(entry);
 	pte = hugepage_shift_to_tte(entry, shift);
 
 #ifdef CONFIG_SPARC64
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index d1897a69c540..52c462390aee 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
 static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
 				       vm_flags_t flags)
 {
-	return entry;
+	return pte_mkhuge(entry);
 }
 #endif
 
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 61895cc01d09..5ca253c1b4e4 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4637,7 +4637,6 @@ static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,
 					   vma->vm_page_prot));
 	}
 	entry = pte_mkyoung(entry);
-	entry = pte_mkhuge(entry);
 	entry = arch_make_huge_pte(entry, shift, vma->vm_flags);
 
 	return entry;
@@ -6172,7 +6171,7 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
 			unsigned int shift = huge_page_shift(hstate_vma(vma));
 
 			old_pte = huge_ptep_modify_prot_start(vma, address, ptep);
-			pte = pte_mkhuge(huge_pte_modify(old_pte, newprot));
+			pte = huge_pte_modify(old_pte, newprot);
 			pte = arch_make_huge_pte(pte, shift, vma->vm_flags);
 			huge_ptep_modify_prot_commit(vma, address, ptep, old_pte, pte);
 			pages++;
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 4165304d3547..d0b14dd73adc 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -118,7 +118,6 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
 		if (size != PAGE_SIZE) {
 			pte_t entry = pfn_pte(pfn, prot);
 
-			entry = pte_mkhuge(entry);
 			entry = arch_make_huge_pte(entry, ilog2(size), 0);
 			set_huge_pte_at(&init_mm, addr, pte, entry);
 			pfn += PFN_DOWN(size);
-- 
2.25.1


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

* [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02  5:38 ` Anshuman Khandual
  0 siblings, 0 replies; 24+ messages in thread
From: Anshuman Khandual @ 2022-02-02  5:38 UTC (permalink / raw)
  To: linux-mm
  Cc: Anshuman Khandual, Catalin Marinas, linuxppc-dev, linux-kernel,
	Paul Mackerras, sparclinux, Andrew Morton, Will Deacon,
	David S. Miller, linux-arm-kernel, Mike Kravetz

Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
This updates generic fallback stub for arch_make_huge_pte() and available
platforms definitions. This makes huge pte creation much cleaner and easier
to follow.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: sparclinux@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/arm64/mm/hugetlbpage.c                      | 1 +
 arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
 arch/sparc/mm/hugetlbpage.c                      | 1 +
 include/linux/hugetlb.h                          | 2 +-
 mm/hugetlb.c                                     | 3 +--
 mm/vmalloc.c                                     | 1 -
 6 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index ffb9c229610a..228226c5fa80 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -347,6 +347,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
 {
 	size_t pagesize = 1UL << shift;
 
+	entry = pte_mkhuge(entry);
 	if (pagesize == CONT_PTE_SIZE) {
 		entry = pte_mkcont(entry);
 	} else if (pagesize == CONT_PMD_SIZE) {
diff --git a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
index 64b6c608eca4..e41e095158c7 100644
--- a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
+++ b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
@@ -70,6 +70,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags
 {
 	size_t size = 1UL << shift;
 
+	entry = pte_mkhuge(entry);
 	if (size == SZ_16K)
 		return __pte(pte_val(entry) & ~_PAGE_HUGE);
 	else
diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
index 0f49fada2093..d8e0e3c7038d 100644
--- a/arch/sparc/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
@@ -181,6 +181,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
 {
 	pte_t pte;
 
+	entry = pte_mkhuge(entry);
 	pte = hugepage_shift_to_tte(entry, shift);
 
 #ifdef CONFIG_SPARC64
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index d1897a69c540..52c462390aee 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
 static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
 				       vm_flags_t flags)
 {
-	return entry;
+	return pte_mkhuge(entry);
 }
 #endif
 
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 61895cc01d09..5ca253c1b4e4 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4637,7 +4637,6 @@ static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,
 					   vma->vm_page_prot));
 	}
 	entry = pte_mkyoung(entry);
-	entry = pte_mkhuge(entry);
 	entry = arch_make_huge_pte(entry, shift, vma->vm_flags);
 
 	return entry;
@@ -6172,7 +6171,7 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
 			unsigned int shift = huge_page_shift(hstate_vma(vma));
 
 			old_pte = huge_ptep_modify_prot_start(vma, address, ptep);
-			pte = pte_mkhuge(huge_pte_modify(old_pte, newprot));
+			pte = huge_pte_modify(old_pte, newprot);
 			pte = arch_make_huge_pte(pte, shift, vma->vm_flags);
 			huge_ptep_modify_prot_commit(vma, address, ptep, old_pte, pte);
 			pages++;
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 4165304d3547..d0b14dd73adc 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -118,7 +118,6 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
 		if (size != PAGE_SIZE) {
 			pte_t entry = pfn_pte(pfn, prot);
 
-			entry = pte_mkhuge(entry);
 			entry = arch_make_huge_pte(entry, ilog2(size), 0);
 			set_huge_pte_at(&init_mm, addr, pte, entry);
 			pfn += PFN_DOWN(size);
-- 
2.25.1


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

* [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02  5:38 ` Anshuman Khandual
  0 siblings, 0 replies; 24+ messages in thread
From: Anshuman Khandual @ 2022-02-02  5:38 UTC (permalink / raw)
  To: linux-mm
  Cc: Anshuman Khandual, Catalin Marinas, Will Deacon,
	Michael Ellerman, Paul Mackerras, David S. Miller, Mike Kravetz,
	Andrew Morton, linux-arm-kernel, linuxppc-dev, sparclinux,
	linux-kernel

Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
This updates generic fallback stub for arch_make_huge_pte() and available
platforms definitions. This makes huge pte creation much cleaner and easier
to follow.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: sparclinux@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/arm64/mm/hugetlbpage.c                      | 1 +
 arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
 arch/sparc/mm/hugetlbpage.c                      | 1 +
 include/linux/hugetlb.h                          | 2 +-
 mm/hugetlb.c                                     | 3 +--
 mm/vmalloc.c                                     | 1 -
 6 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index ffb9c229610a..228226c5fa80 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -347,6 +347,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
 {
 	size_t pagesize = 1UL << shift;
 
+	entry = pte_mkhuge(entry);
 	if (pagesize == CONT_PTE_SIZE) {
 		entry = pte_mkcont(entry);
 	} else if (pagesize == CONT_PMD_SIZE) {
diff --git a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
index 64b6c608eca4..e41e095158c7 100644
--- a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
+++ b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
@@ -70,6 +70,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags
 {
 	size_t size = 1UL << shift;
 
+	entry = pte_mkhuge(entry);
 	if (size == SZ_16K)
 		return __pte(pte_val(entry) & ~_PAGE_HUGE);
 	else
diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
index 0f49fada2093..d8e0e3c7038d 100644
--- a/arch/sparc/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
@@ -181,6 +181,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
 {
 	pte_t pte;
 
+	entry = pte_mkhuge(entry);
 	pte = hugepage_shift_to_tte(entry, shift);
 
 #ifdef CONFIG_SPARC64
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index d1897a69c540..52c462390aee 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
 static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
 				       vm_flags_t flags)
 {
-	return entry;
+	return pte_mkhuge(entry);
 }
 #endif
 
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 61895cc01d09..5ca253c1b4e4 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4637,7 +4637,6 @@ static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,
 					   vma->vm_page_prot));
 	}
 	entry = pte_mkyoung(entry);
-	entry = pte_mkhuge(entry);
 	entry = arch_make_huge_pte(entry, shift, vma->vm_flags);
 
 	return entry;
@@ -6172,7 +6171,7 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
 			unsigned int shift = huge_page_shift(hstate_vma(vma));
 
 			old_pte = huge_ptep_modify_prot_start(vma, address, ptep);
-			pte = pte_mkhuge(huge_pte_modify(old_pte, newprot));
+			pte = huge_pte_modify(old_pte, newprot);
 			pte = arch_make_huge_pte(pte, shift, vma->vm_flags);
 			huge_ptep_modify_prot_commit(vma, address, ptep, old_pte, pte);
 			pages++;
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 4165304d3547..d0b14dd73adc 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -118,7 +118,6 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
 		if (size != PAGE_SIZE) {
 			pte_t entry = pfn_pte(pfn, prot);
 
-			entry = pte_mkhuge(entry);
 			entry = arch_make_huge_pte(entry, ilog2(size), 0);
 			set_huge_pte_at(&init_mm, addr, pte, entry);
 			pfn += PFN_DOWN(size);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
  2022-02-02  5:38 ` Anshuman Khandual
  (?)
@ 2022-02-02  6:18   ` Mike Rapoport
  -1 siblings, 0 replies; 24+ messages in thread
From: Mike Rapoport @ 2022-02-02  6:18 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, Catalin Marinas, Will Deacon, Michael Ellerman,
	Paul Mackerras, David S. Miller, Mike Kravetz, Andrew Morton,
	linux-arm-kernel, linuxppc-dev, sparclinux, linux-kernel

On Wed, Feb 02, 2022 at 11:08:06AM +0530, Anshuman Khandual wrote:
> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> This updates generic fallback stub for arch_make_huge_pte() and available
> platforms definitions. This makes huge pte creation much cleaner and easier
> to follow.

Won't it break architectures that don't define arch_make_huge_pte()?
 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  arch/arm64/mm/hugetlbpage.c                      | 1 +
>  arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
>  arch/sparc/mm/hugetlbpage.c                      | 1 +
>  include/linux/hugetlb.h                          | 2 +-
>  mm/hugetlb.c                                     | 3 +--
>  mm/vmalloc.c                                     | 1 -
>  6 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> index ffb9c229610a..228226c5fa80 100644
> --- a/arch/arm64/mm/hugetlbpage.c
> +++ b/arch/arm64/mm/hugetlbpage.c
> @@ -347,6 +347,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>  {
>  	size_t pagesize = 1UL << shift;
>  
> +	entry = pte_mkhuge(entry);
>  	if (pagesize == CONT_PTE_SIZE) {
>  		entry = pte_mkcont(entry);
>  	} else if (pagesize == CONT_PMD_SIZE) {
> diff --git a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> index 64b6c608eca4..e41e095158c7 100644
> --- a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> +++ b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> @@ -70,6 +70,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags
>  {
>  	size_t size = 1UL << shift;
>  
> +	entry = pte_mkhuge(entry);
>  	if (size == SZ_16K)
>  		return __pte(pte_val(entry) & ~_PAGE_HUGE);
>  	else
> diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
> index 0f49fada2093..d8e0e3c7038d 100644
> --- a/arch/sparc/mm/hugetlbpage.c
> +++ b/arch/sparc/mm/hugetlbpage.c
> @@ -181,6 +181,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>  {
>  	pte_t pte;
>  
> +	entry = pte_mkhuge(entry);
>  	pte = hugepage_shift_to_tte(entry, shift);
>  
>  #ifdef CONFIG_SPARC64
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index d1897a69c540..52c462390aee 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
>  static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
>  				       vm_flags_t flags)
>  {
> -	return entry;
> +	return pte_mkhuge(entry);
>  }
>  #endif
>  
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 61895cc01d09..5ca253c1b4e4 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -4637,7 +4637,6 @@ static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,
>  					   vma->vm_page_prot));
>  	}
>  	entry = pte_mkyoung(entry);
> -	entry = pte_mkhuge(entry);
>  	entry = arch_make_huge_pte(entry, shift, vma->vm_flags);
>  
>  	return entry;
> @@ -6172,7 +6171,7 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
>  			unsigned int shift = huge_page_shift(hstate_vma(vma));
>  
>  			old_pte = huge_ptep_modify_prot_start(vma, address, ptep);
> -			pte = pte_mkhuge(huge_pte_modify(old_pte, newprot));
> +			pte = huge_pte_modify(old_pte, newprot);
>  			pte = arch_make_huge_pte(pte, shift, vma->vm_flags);
>  			huge_ptep_modify_prot_commit(vma, address, ptep, old_pte, pte);
>  			pages++;
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 4165304d3547..d0b14dd73adc 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -118,7 +118,6 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
>  		if (size != PAGE_SIZE) {
>  			pte_t entry = pfn_pte(pfn, prot);
>  
> -			entry = pte_mkhuge(entry);
>  			entry = arch_make_huge_pte(entry, ilog2(size), 0);
>  			set_huge_pte_at(&init_mm, addr, pte, entry);
>  			pfn += PFN_DOWN(size);
> -- 
> 2.25.1
> 
> 

-- 
Sincerely yours,
Mike.

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02  6:18   ` Mike Rapoport
  0 siblings, 0 replies; 24+ messages in thread
From: Mike Rapoport @ 2022-02-02  6:18 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linuxppc-dev, linux-kernel, linux-mm, Paul Mackerras,
	Catalin Marinas, sparclinux, Andrew Morton, Will Deacon,
	David S. Miller, linux-arm-kernel, Mike Kravetz

On Wed, Feb 02, 2022 at 11:08:06AM +0530, Anshuman Khandual wrote:
> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> This updates generic fallback stub for arch_make_huge_pte() and available
> platforms definitions. This makes huge pte creation much cleaner and easier
> to follow.

Won't it break architectures that don't define arch_make_huge_pte()?
 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  arch/arm64/mm/hugetlbpage.c                      | 1 +
>  arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
>  arch/sparc/mm/hugetlbpage.c                      | 1 +
>  include/linux/hugetlb.h                          | 2 +-
>  mm/hugetlb.c                                     | 3 +--
>  mm/vmalloc.c                                     | 1 -
>  6 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> index ffb9c229610a..228226c5fa80 100644
> --- a/arch/arm64/mm/hugetlbpage.c
> +++ b/arch/arm64/mm/hugetlbpage.c
> @@ -347,6 +347,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>  {
>  	size_t pagesize = 1UL << shift;
>  
> +	entry = pte_mkhuge(entry);
>  	if (pagesize == CONT_PTE_SIZE) {
>  		entry = pte_mkcont(entry);
>  	} else if (pagesize == CONT_PMD_SIZE) {
> diff --git a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> index 64b6c608eca4..e41e095158c7 100644
> --- a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> +++ b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> @@ -70,6 +70,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags
>  {
>  	size_t size = 1UL << shift;
>  
> +	entry = pte_mkhuge(entry);
>  	if (size == SZ_16K)
>  		return __pte(pte_val(entry) & ~_PAGE_HUGE);
>  	else
> diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
> index 0f49fada2093..d8e0e3c7038d 100644
> --- a/arch/sparc/mm/hugetlbpage.c
> +++ b/arch/sparc/mm/hugetlbpage.c
> @@ -181,6 +181,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>  {
>  	pte_t pte;
>  
> +	entry = pte_mkhuge(entry);
>  	pte = hugepage_shift_to_tte(entry, shift);
>  
>  #ifdef CONFIG_SPARC64
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index d1897a69c540..52c462390aee 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
>  static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
>  				       vm_flags_t flags)
>  {
> -	return entry;
> +	return pte_mkhuge(entry);
>  }
>  #endif
>  
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 61895cc01d09..5ca253c1b4e4 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -4637,7 +4637,6 @@ static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,
>  					   vma->vm_page_prot));
>  	}
>  	entry = pte_mkyoung(entry);
> -	entry = pte_mkhuge(entry);
>  	entry = arch_make_huge_pte(entry, shift, vma->vm_flags);
>  
>  	return entry;
> @@ -6172,7 +6171,7 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
>  			unsigned int shift = huge_page_shift(hstate_vma(vma));
>  
>  			old_pte = huge_ptep_modify_prot_start(vma, address, ptep);
> -			pte = pte_mkhuge(huge_pte_modify(old_pte, newprot));
> +			pte = huge_pte_modify(old_pte, newprot);
>  			pte = arch_make_huge_pte(pte, shift, vma->vm_flags);
>  			huge_ptep_modify_prot_commit(vma, address, ptep, old_pte, pte);
>  			pages++;
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 4165304d3547..d0b14dd73adc 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -118,7 +118,6 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
>  		if (size != PAGE_SIZE) {
>  			pte_t entry = pfn_pte(pfn, prot);
>  
> -			entry = pte_mkhuge(entry);
>  			entry = arch_make_huge_pte(entry, ilog2(size), 0);
>  			set_huge_pte_at(&init_mm, addr, pte, entry);
>  			pfn += PFN_DOWN(size);
> -- 
> 2.25.1
> 
> 

-- 
Sincerely yours,
Mike.

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02  6:18   ` Mike Rapoport
  0 siblings, 0 replies; 24+ messages in thread
From: Mike Rapoport @ 2022-02-02  6:18 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, Catalin Marinas, Will Deacon, Michael Ellerman,
	Paul Mackerras, David S. Miller, Mike Kravetz, Andrew Morton,
	linux-arm-kernel, linuxppc-dev, sparclinux, linux-kernel

On Wed, Feb 02, 2022 at 11:08:06AM +0530, Anshuman Khandual wrote:
> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> This updates generic fallback stub for arch_make_huge_pte() and available
> platforms definitions. This makes huge pte creation much cleaner and easier
> to follow.

Won't it break architectures that don't define arch_make_huge_pte()?
 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  arch/arm64/mm/hugetlbpage.c                      | 1 +
>  arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
>  arch/sparc/mm/hugetlbpage.c                      | 1 +
>  include/linux/hugetlb.h                          | 2 +-
>  mm/hugetlb.c                                     | 3 +--
>  mm/vmalloc.c                                     | 1 -
>  6 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> index ffb9c229610a..228226c5fa80 100644
> --- a/arch/arm64/mm/hugetlbpage.c
> +++ b/arch/arm64/mm/hugetlbpage.c
> @@ -347,6 +347,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>  {
>  	size_t pagesize = 1UL << shift;
>  
> +	entry = pte_mkhuge(entry);
>  	if (pagesize == CONT_PTE_SIZE) {
>  		entry = pte_mkcont(entry);
>  	} else if (pagesize == CONT_PMD_SIZE) {
> diff --git a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> index 64b6c608eca4..e41e095158c7 100644
> --- a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> +++ b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> @@ -70,6 +70,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags
>  {
>  	size_t size = 1UL << shift;
>  
> +	entry = pte_mkhuge(entry);
>  	if (size == SZ_16K)
>  		return __pte(pte_val(entry) & ~_PAGE_HUGE);
>  	else
> diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
> index 0f49fada2093..d8e0e3c7038d 100644
> --- a/arch/sparc/mm/hugetlbpage.c
> +++ b/arch/sparc/mm/hugetlbpage.c
> @@ -181,6 +181,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>  {
>  	pte_t pte;
>  
> +	entry = pte_mkhuge(entry);
>  	pte = hugepage_shift_to_tte(entry, shift);
>  
>  #ifdef CONFIG_SPARC64
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index d1897a69c540..52c462390aee 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
>  static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
>  				       vm_flags_t flags)
>  {
> -	return entry;
> +	return pte_mkhuge(entry);
>  }
>  #endif
>  
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 61895cc01d09..5ca253c1b4e4 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -4637,7 +4637,6 @@ static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,
>  					   vma->vm_page_prot));
>  	}
>  	entry = pte_mkyoung(entry);
> -	entry = pte_mkhuge(entry);
>  	entry = arch_make_huge_pte(entry, shift, vma->vm_flags);
>  
>  	return entry;
> @@ -6172,7 +6171,7 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
>  			unsigned int shift = huge_page_shift(hstate_vma(vma));
>  
>  			old_pte = huge_ptep_modify_prot_start(vma, address, ptep);
> -			pte = pte_mkhuge(huge_pte_modify(old_pte, newprot));
> +			pte = huge_pte_modify(old_pte, newprot);
>  			pte = arch_make_huge_pte(pte, shift, vma->vm_flags);
>  			huge_ptep_modify_prot_commit(vma, address, ptep, old_pte, pte);
>  			pages++;
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 4165304d3547..d0b14dd73adc 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -118,7 +118,6 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
>  		if (size != PAGE_SIZE) {
>  			pte_t entry = pfn_pte(pfn, prot);
>  
> -			entry = pte_mkhuge(entry);
>  			entry = arch_make_huge_pte(entry, ilog2(size), 0);
>  			set_huge_pte_at(&init_mm, addr, pte, entry);
>  			pfn += PFN_DOWN(size);
> -- 
> 2.25.1
> 
> 

-- 
Sincerely yours,
Mike.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
  2022-02-02  5:38 ` Anshuman Khandual
  (?)
@ 2022-02-02  6:20   ` Christophe Leroy
  -1 siblings, 0 replies; 24+ messages in thread
From: Christophe Leroy @ 2022-02-02  6:20 UTC (permalink / raw)
  To: Anshuman Khandual, linux-mm
  Cc: Catalin Marinas, linuxppc-dev, linux-kernel, Paul Mackerras,
	sparclinux, Andrew Morton, Will Deacon, David S. Miller,
	linux-arm-kernel, Mike Kravetz



Le 02/02/2022 à 06:38, Anshuman Khandual a écrit :
> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> This updates generic fallback stub for arch_make_huge_pte() and available
> platforms definitions. This makes huge pte creation much cleaner and easier
> to follow.

I think it is a good cleanup. I always wonder why commit d9ed9faac283 
("mm: add new arch_make_huge_pte() method for tile support") didn't move 
the pte_mkhuge() into arch_make_huge_pte().

When I implemented arch_make_huge_pte() for powerpc 8xx, in one case 
arch_make_huge_pte() have to undo the things done by pte_mkhuge(), see below

As a second step we could probably try to get rid of pte_mkhuge() 
completely, at least in the core.

> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

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

> ---
>   arch/arm64/mm/hugetlbpage.c                      | 1 +
>   arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
>   arch/sparc/mm/hugetlbpage.c                      | 1 +
>   include/linux/hugetlb.h                          | 2 +-
>   mm/hugetlb.c                                     | 3 +--
>   mm/vmalloc.c                                     | 1 -
>   6 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> index ffb9c229610a..228226c5fa80 100644
> --- a/arch/arm64/mm/hugetlbpage.c
> +++ b/arch/arm64/mm/hugetlbpage.c
> @@ -347,6 +347,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>   {
>   	size_t pagesize = 1UL << shift;
>   
> +	entry = pte_mkhuge(entry);
>   	if (pagesize == CONT_PTE_SIZE) {
>   		entry = pte_mkcont(entry);
>   	} else if (pagesize == CONT_PMD_SIZE) {
> diff --git a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> index 64b6c608eca4..e41e095158c7 100644
> --- a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> +++ b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> @@ -70,6 +70,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags
>   {
>   	size_t size = 1UL << shift;
>   
> +	entry = pte_mkhuge(entry);

Could drop that and replace the below by:

	if (size == SZ_16K)
		return __pte(pte_val(entry) | _PAGE_SPS);
	else
		return __pte(pte_val(entry) | _PAGE_SPS | _PAGE_HUGE);
	

>   	if (size == SZ_16K)
>   		return __pte(pte_val(entry) & ~_PAGE_HUGE);
>   	else
> diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
> index 0f49fada2093..d8e0e3c7038d 100644
> --- a/arch/sparc/mm/hugetlbpage.c
> +++ b/arch/sparc/mm/hugetlbpage.c
> @@ -181,6 +181,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>   {
>   	pte_t pte;
>   
> +	entry = pte_mkhuge(entry);
>   	pte = hugepage_shift_to_tte(entry, shift);
>   
>   #ifdef CONFIG_SPARC64
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index d1897a69c540..52c462390aee 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
>   static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
>   				       vm_flags_t flags)
>   {
> -	return entry;
> +	return pte_mkhuge(entry);
>   }
>   #endif
>   
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 61895cc01d09..5ca253c1b4e4 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -4637,7 +4637,6 @@ static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,
>   					   vma->vm_page_prot));
>   	}
>   	entry = pte_mkyoung(entry);
> -	entry = pte_mkhuge(entry);
>   	entry = arch_make_huge_pte(entry, shift, vma->vm_flags);
>   
>   	return entry;
> @@ -6172,7 +6171,7 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
>   			unsigned int shift = huge_page_shift(hstate_vma(vma));
>   
>   			old_pte = huge_ptep_modify_prot_start(vma, address, ptep);
> -			pte = pte_mkhuge(huge_pte_modify(old_pte, newprot));
> +			pte = huge_pte_modify(old_pte, newprot);
>   			pte = arch_make_huge_pte(pte, shift, vma->vm_flags);
>   			huge_ptep_modify_prot_commit(vma, address, ptep, old_pte, pte);
>   			pages++;
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 4165304d3547..d0b14dd73adc 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -118,7 +118,6 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
>   		if (size != PAGE_SIZE) {
>   			pte_t entry = pfn_pte(pfn, prot);
>   
> -			entry = pte_mkhuge(entry);
>   			entry = arch_make_huge_pte(entry, ilog2(size), 0);
>   			set_huge_pte_at(&init_mm, addr, pte, entry);
>   			pfn += PFN_DOWN(size);

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02  6:20   ` Christophe Leroy
  0 siblings, 0 replies; 24+ messages in thread
From: Christophe Leroy @ 2022-02-02  6:20 UTC (permalink / raw)
  To: Anshuman Khandual, linux-mm
  Cc: Will Deacon, Catalin Marinas, linux-kernel, Paul Mackerras,
	sparclinux, Andrew Morton, linuxppc-dev, David S. Miller,
	linux-arm-kernel, Mike Kravetz



Le 02/02/2022 à 06:38, Anshuman Khandual a écrit :
> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> This updates generic fallback stub for arch_make_huge_pte() and available
> platforms definitions. This makes huge pte creation much cleaner and easier
> to follow.

I think it is a good cleanup. I always wonder why commit d9ed9faac283 
("mm: add new arch_make_huge_pte() method for tile support") didn't move 
the pte_mkhuge() into arch_make_huge_pte().

When I implemented arch_make_huge_pte() for powerpc 8xx, in one case 
arch_make_huge_pte() have to undo the things done by pte_mkhuge(), see below

As a second step we could probably try to get rid of pte_mkhuge() 
completely, at least in the core.

> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

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

> ---
>   arch/arm64/mm/hugetlbpage.c                      | 1 +
>   arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
>   arch/sparc/mm/hugetlbpage.c                      | 1 +
>   include/linux/hugetlb.h                          | 2 +-
>   mm/hugetlb.c                                     | 3 +--
>   mm/vmalloc.c                                     | 1 -
>   6 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> index ffb9c229610a..228226c5fa80 100644
> --- a/arch/arm64/mm/hugetlbpage.c
> +++ b/arch/arm64/mm/hugetlbpage.c
> @@ -347,6 +347,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>   {
>   	size_t pagesize = 1UL << shift;
>   
> +	entry = pte_mkhuge(entry);
>   	if (pagesize == CONT_PTE_SIZE) {
>   		entry = pte_mkcont(entry);
>   	} else if (pagesize == CONT_PMD_SIZE) {
> diff --git a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> index 64b6c608eca4..e41e095158c7 100644
> --- a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> +++ b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> @@ -70,6 +70,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags
>   {
>   	size_t size = 1UL << shift;
>   
> +	entry = pte_mkhuge(entry);

Could drop that and replace the below by:

	if (size == SZ_16K)
		return __pte(pte_val(entry) | _PAGE_SPS);
	else
		return __pte(pte_val(entry) | _PAGE_SPS | _PAGE_HUGE);
	

>   	if (size == SZ_16K)
>   		return __pte(pte_val(entry) & ~_PAGE_HUGE);
>   	else
> diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
> index 0f49fada2093..d8e0e3c7038d 100644
> --- a/arch/sparc/mm/hugetlbpage.c
> +++ b/arch/sparc/mm/hugetlbpage.c
> @@ -181,6 +181,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>   {
>   	pte_t pte;
>   
> +	entry = pte_mkhuge(entry);
>   	pte = hugepage_shift_to_tte(entry, shift);
>   
>   #ifdef CONFIG_SPARC64
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index d1897a69c540..52c462390aee 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
>   static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
>   				       vm_flags_t flags)
>   {
> -	return entry;
> +	return pte_mkhuge(entry);
>   }
>   #endif
>   
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 61895cc01d09..5ca253c1b4e4 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -4637,7 +4637,6 @@ static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,
>   					   vma->vm_page_prot));
>   	}
>   	entry = pte_mkyoung(entry);
> -	entry = pte_mkhuge(entry);
>   	entry = arch_make_huge_pte(entry, shift, vma->vm_flags);
>   
>   	return entry;
> @@ -6172,7 +6171,7 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
>   			unsigned int shift = huge_page_shift(hstate_vma(vma));
>   
>   			old_pte = huge_ptep_modify_prot_start(vma, address, ptep);
> -			pte = pte_mkhuge(huge_pte_modify(old_pte, newprot));
> +			pte = huge_pte_modify(old_pte, newprot);
>   			pte = arch_make_huge_pte(pte, shift, vma->vm_flags);
>   			huge_ptep_modify_prot_commit(vma, address, ptep, old_pte, pte);
>   			pages++;
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 4165304d3547..d0b14dd73adc 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -118,7 +118,6 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
>   		if (size != PAGE_SIZE) {
>   			pte_t entry = pfn_pte(pfn, prot);
>   
> -			entry = pte_mkhuge(entry);
>   			entry = arch_make_huge_pte(entry, ilog2(size), 0);
>   			set_huge_pte_at(&init_mm, addr, pte, entry);
>   			pfn += PFN_DOWN(size);

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02  6:20   ` Christophe Leroy
  0 siblings, 0 replies; 24+ messages in thread
From: Christophe Leroy @ 2022-02-02  6:20 UTC (permalink / raw)
  To: Anshuman Khandual, linux-mm
  Cc: Catalin Marinas, linuxppc-dev, linux-kernel, Paul Mackerras,
	sparclinux, Andrew Morton, Will Deacon, David S. Miller,
	linux-arm-kernel, Mike Kravetz



Le 02/02/2022 à 06:38, Anshuman Khandual a écrit :
> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> This updates generic fallback stub for arch_make_huge_pte() and available
> platforms definitions. This makes huge pte creation much cleaner and easier
> to follow.

I think it is a good cleanup. I always wonder why commit d9ed9faac283 
("mm: add new arch_make_huge_pte() method for tile support") didn't move 
the pte_mkhuge() into arch_make_huge_pte().

When I implemented arch_make_huge_pte() for powerpc 8xx, in one case 
arch_make_huge_pte() have to undo the things done by pte_mkhuge(), see below

As a second step we could probably try to get rid of pte_mkhuge() 
completely, at least in the core.

> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

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

> ---
>   arch/arm64/mm/hugetlbpage.c                      | 1 +
>   arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
>   arch/sparc/mm/hugetlbpage.c                      | 1 +
>   include/linux/hugetlb.h                          | 2 +-
>   mm/hugetlb.c                                     | 3 +--
>   mm/vmalloc.c                                     | 1 -
>   6 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> index ffb9c229610a..228226c5fa80 100644
> --- a/arch/arm64/mm/hugetlbpage.c
> +++ b/arch/arm64/mm/hugetlbpage.c
> @@ -347,6 +347,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>   {
>   	size_t pagesize = 1UL << shift;
>   
> +	entry = pte_mkhuge(entry);
>   	if (pagesize == CONT_PTE_SIZE) {
>   		entry = pte_mkcont(entry);
>   	} else if (pagesize == CONT_PMD_SIZE) {
> diff --git a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> index 64b6c608eca4..e41e095158c7 100644
> --- a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> +++ b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
> @@ -70,6 +70,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags
>   {
>   	size_t size = 1UL << shift;
>   
> +	entry = pte_mkhuge(entry);

Could drop that and replace the below by:

	if (size == SZ_16K)
		return __pte(pte_val(entry) | _PAGE_SPS);
	else
		return __pte(pte_val(entry) | _PAGE_SPS | _PAGE_HUGE);
	

>   	if (size == SZ_16K)
>   		return __pte(pte_val(entry) & ~_PAGE_HUGE);
>   	else
> diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
> index 0f49fada2093..d8e0e3c7038d 100644
> --- a/arch/sparc/mm/hugetlbpage.c
> +++ b/arch/sparc/mm/hugetlbpage.c
> @@ -181,6 +181,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>   {
>   	pte_t pte;
>   
> +	entry = pte_mkhuge(entry);
>   	pte = hugepage_shift_to_tte(entry, shift);
>   
>   #ifdef CONFIG_SPARC64
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index d1897a69c540..52c462390aee 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
>   static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
>   				       vm_flags_t flags)
>   {
> -	return entry;
> +	return pte_mkhuge(entry);
>   }
>   #endif
>   
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 61895cc01d09..5ca253c1b4e4 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -4637,7 +4637,6 @@ static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,
>   					   vma->vm_page_prot));
>   	}
>   	entry = pte_mkyoung(entry);
> -	entry = pte_mkhuge(entry);
>   	entry = arch_make_huge_pte(entry, shift, vma->vm_flags);
>   
>   	return entry;
> @@ -6172,7 +6171,7 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
>   			unsigned int shift = huge_page_shift(hstate_vma(vma));
>   
>   			old_pte = huge_ptep_modify_prot_start(vma, address, ptep);
> -			pte = pte_mkhuge(huge_pte_modify(old_pte, newprot));
> +			pte = huge_pte_modify(old_pte, newprot);
>   			pte = arch_make_huge_pte(pte, shift, vma->vm_flags);
>   			huge_ptep_modify_prot_commit(vma, address, ptep, old_pte, pte);
>   			pages++;
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 4165304d3547..d0b14dd73adc 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -118,7 +118,6 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
>   		if (size != PAGE_SIZE) {
>   			pte_t entry = pfn_pte(pfn, prot);
>   
> -			entry = pte_mkhuge(entry);
>   			entry = arch_make_huge_pte(entry, ilog2(size), 0);
>   			set_huge_pte_at(&init_mm, addr, pte, entry);
>   			pfn += PFN_DOWN(size);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
  2022-02-02  6:18   ` Mike Rapoport
  (?)
@ 2022-02-02  6:25     ` Christophe Leroy
  -1 siblings, 0 replies; 24+ messages in thread
From: Christophe Leroy @ 2022-02-02  6:25 UTC (permalink / raw)
  To: Mike Rapoport, Anshuman Khandual
  Cc: linuxppc-dev, linux-kernel, linux-mm, Paul Mackerras,
	Catalin Marinas, sparclinux, Andrew Morton, Will Deacon,
	David S. Miller, linux-arm-kernel, Mike Kravetz



Le 02/02/2022 à 07:18, Mike Rapoport a écrit :
> On Wed, Feb 02, 2022 at 11:08:06AM +0530, Anshuman Khandual wrote:
>> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
>> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
>> This updates generic fallback stub for arch_make_huge_pte() and available
>> platforms definitions. This makes huge pte creation much cleaner and easier
>> to follow.
> 
> Won't it break architectures that don't define arch_make_huge_pte()?

It shouldn't, see below

>> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
>> index d1897a69c540..52c462390aee 100644
>> --- a/include/linux/hugetlb.h
>> +++ b/include/linux/hugetlb.h
>> @@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
>>   static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
>>   				       vm_flags_t flags)
>>   {
>> -	return entry;
>> +	return pte_mkhuge(entry);
>>   }
>>   #endif
>>   

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02  6:25     ` Christophe Leroy
  0 siblings, 0 replies; 24+ messages in thread
From: Christophe Leroy @ 2022-02-02  6:25 UTC (permalink / raw)
  To: Mike Rapoport, Anshuman Khandual
  Cc: Will Deacon, Catalin Marinas, linux-kernel, linux-mm,
	Paul Mackerras, sparclinux, Andrew Morton, linuxppc-dev,
	David S. Miller, linux-arm-kernel, Mike Kravetz



Le 02/02/2022 à 07:18, Mike Rapoport a écrit :
> On Wed, Feb 02, 2022 at 11:08:06AM +0530, Anshuman Khandual wrote:
>> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
>> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
>> This updates generic fallback stub for arch_make_huge_pte() and available
>> platforms definitions. This makes huge pte creation much cleaner and easier
>> to follow.
> 
> Won't it break architectures that don't define arch_make_huge_pte()?

It shouldn't, see below

>> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
>> index d1897a69c540..52c462390aee 100644
>> --- a/include/linux/hugetlb.h
>> +++ b/include/linux/hugetlb.h
>> @@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
>>   static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
>>   				       vm_flags_t flags)
>>   {
>> -	return entry;
>> +	return pte_mkhuge(entry);
>>   }
>>   #endif
>>   

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02  6:25     ` Christophe Leroy
  0 siblings, 0 replies; 24+ messages in thread
From: Christophe Leroy @ 2022-02-02  6:25 UTC (permalink / raw)
  To: Mike Rapoport, Anshuman Khandual
  Cc: linuxppc-dev, linux-kernel, linux-mm, Paul Mackerras,
	Catalin Marinas, sparclinux, Andrew Morton, Will Deacon,
	David S. Miller, linux-arm-kernel, Mike Kravetz



Le 02/02/2022 à 07:18, Mike Rapoport a écrit :
> On Wed, Feb 02, 2022 at 11:08:06AM +0530, Anshuman Khandual wrote:
>> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
>> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
>> This updates generic fallback stub for arch_make_huge_pte() and available
>> platforms definitions. This makes huge pte creation much cleaner and easier
>> to follow.
> 
> Won't it break architectures that don't define arch_make_huge_pte()?

It shouldn't, see below

>> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
>> index d1897a69c540..52c462390aee 100644
>> --- a/include/linux/hugetlb.h
>> +++ b/include/linux/hugetlb.h
>> @@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
>>   static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
>>   				       vm_flags_t flags)
>>   {
>> -	return entry;
>> +	return pte_mkhuge(entry);
>>   }
>>   #endif
>>   
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
  2022-02-02  6:25     ` Christophe Leroy
  (?)
@ 2022-02-02  7:37       ` Mike Rapoport
  -1 siblings, 0 replies; 24+ messages in thread
From: Mike Rapoport @ 2022-02-02  7:37 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Anshuman Khandual, linuxppc-dev, linux-kernel, linux-mm,
	Paul Mackerras, Catalin Marinas, sparclinux, Andrew Morton,
	Will Deacon, David S. Miller, linux-arm-kernel, Mike Kravetz

On Wed, Feb 02, 2022 at 06:25:31AM +0000, Christophe Leroy wrote:
> 
> 
> Le 02/02/2022 à 07:18, Mike Rapoport a écrit :
> > On Wed, Feb 02, 2022 at 11:08:06AM +0530, Anshuman Khandual wrote:
> >> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> >> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> >> This updates generic fallback stub for arch_make_huge_pte() and available
> >> platforms definitions. This makes huge pte creation much cleaner and easier
> >> to follow.
> > 
> > Won't it break architectures that don't define arch_make_huge_pte()?
> 
> It shouldn't, see below

Right, overlooked that.
 
> >> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> >> index d1897a69c540..52c462390aee 100644
> >> --- a/include/linux/hugetlb.h
> >> +++ b/include/linux/hugetlb.h
> >> @@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
> >>   static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
> >>   				       vm_flags_t flags)
> >>   {
> >> -	return entry;
> >> +	return pte_mkhuge(entry);
> >>   }
> >>   #endif
> >>   

-- 
Sincerely yours,
Mike.

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02  7:37       ` Mike Rapoport
  0 siblings, 0 replies; 24+ messages in thread
From: Mike Rapoport @ 2022-02-02  7:37 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Will Deacon, Anshuman Khandual, Catalin Marinas, linux-kernel,
	linux-mm, Paul Mackerras, sparclinux, Andrew Morton,
	linuxppc-dev, David S. Miller, linux-arm-kernel, Mike Kravetz

On Wed, Feb 02, 2022 at 06:25:31AM +0000, Christophe Leroy wrote:
> 
> 
> Le 02/02/2022 à 07:18, Mike Rapoport a écrit :
> > On Wed, Feb 02, 2022 at 11:08:06AM +0530, Anshuman Khandual wrote:
> >> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> >> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> >> This updates generic fallback stub for arch_make_huge_pte() and available
> >> platforms definitions. This makes huge pte creation much cleaner and easier
> >> to follow.
> > 
> > Won't it break architectures that don't define arch_make_huge_pte()?
> 
> It shouldn't, see below

Right, overlooked that.
 
> >> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> >> index d1897a69c540..52c462390aee 100644
> >> --- a/include/linux/hugetlb.h
> >> +++ b/include/linux/hugetlb.h
> >> @@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
> >>   static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
> >>   				       vm_flags_t flags)
> >>   {
> >> -	return entry;
> >> +	return pte_mkhuge(entry);
> >>   }
> >>   #endif
> >>   

-- 
Sincerely yours,
Mike.

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02  7:37       ` Mike Rapoport
  0 siblings, 0 replies; 24+ messages in thread
From: Mike Rapoport @ 2022-02-02  7:37 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Anshuman Khandual, linuxppc-dev, linux-kernel, linux-mm,
	Paul Mackerras, Catalin Marinas, sparclinux, Andrew Morton,
	Will Deacon, David S. Miller, linux-arm-kernel, Mike Kravetz

On Wed, Feb 02, 2022 at 06:25:31AM +0000, Christophe Leroy wrote:
> 
> 
> Le 02/02/2022 à 07:18, Mike Rapoport a écrit :
> > On Wed, Feb 02, 2022 at 11:08:06AM +0530, Anshuman Khandual wrote:
> >> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> >> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> >> This updates generic fallback stub for arch_make_huge_pte() and available
> >> platforms definitions. This makes huge pte creation much cleaner and easier
> >> to follow.
> > 
> > Won't it break architectures that don't define arch_make_huge_pte()?
> 
> It shouldn't, see below

Right, overlooked that.
 
> >> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> >> index d1897a69c540..52c462390aee 100644
> >> --- a/include/linux/hugetlb.h
> >> +++ b/include/linux/hugetlb.h
> >> @@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
> >>   static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
> >>   				       vm_flags_t flags)
> >>   {
> >> -	return entry;
> >> +	return pte_mkhuge(entry);
> >>   }
> >>   #endif
> >>   

-- 
Sincerely yours,
Mike.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
  2022-02-02  6:20   ` Christophe Leroy
  (?)
@ 2022-02-02  9:38     ` Anshuman Khandual
  -1 siblings, 0 replies; 24+ messages in thread
From: Anshuman Khandual @ 2022-02-02  9:38 UTC (permalink / raw)
  To: Christophe Leroy, linux-mm
  Cc: Catalin Marinas, linuxppc-dev, linux-kernel, Paul Mackerras,
	sparclinux, Andrew Morton, Will Deacon, David S. Miller,
	linux-arm-kernel, Mike Kravetz



On 2/2/22 11:50 AM, Christophe Leroy wrote:
> 
> Le 02/02/2022 à 06:38, Anshuman Khandual a écrit :
>> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
>> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
>> This updates generic fallback stub for arch_make_huge_pte() and available
>> platforms definitions. This makes huge pte creation much cleaner and easier
>> to follow.
> I think it is a good cleanup. I always wonder why commit d9ed9faac283 
> ("mm: add new arch_make_huge_pte() method for tile support") didn't move 
> the pte_mkhuge() into arch_make_huge_pte().

+1

> 
> When I implemented arch_make_huge_pte() for powerpc 8xx, in one case 
> arch_make_huge_pte() have to undo the things done by pte_mkhuge(), see below
> 
> As a second step we could probably try to get rid of pte_mkhuge() 
> completely, at least in the core.

Sure.

> 
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: Michael Ellerman <mpe@ellerman.id.au>
>> Cc: Paul Mackerras <paulus@samba.org>
>> Cc: "David S. Miller" <davem@davemloft.net>
>> Cc: Mike Kravetz <mike.kravetz@oracle.com>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: linuxppc-dev@lists.ozlabs.org
>> Cc: sparclinux@vger.kernel.org
>> Cc: linux-mm@kvack.org
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> 
>> ---
>>   arch/arm64/mm/hugetlbpage.c                      | 1 +
>>   arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
>>   arch/sparc/mm/hugetlbpage.c                      | 1 +
>>   include/linux/hugetlb.h                          | 2 +-
>>   mm/hugetlb.c                                     | 3 +--
>>   mm/vmalloc.c                                     | 1 -
>>   6 files changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
>> index ffb9c229610a..228226c5fa80 100644
>> --- a/arch/arm64/mm/hugetlbpage.c
>> +++ b/arch/arm64/mm/hugetlbpage.c
>> @@ -347,6 +347,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>>   {
>>   	size_t pagesize = 1UL << shift;
>>   
>> +	entry = pte_mkhuge(entry);
>>   	if (pagesize == CONT_PTE_SIZE) {
>>   		entry = pte_mkcont(entry);
>>   	} else if (pagesize == CONT_PMD_SIZE) {
>> diff --git a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
>> index 64b6c608eca4..e41e095158c7 100644
>> --- a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
>> +++ b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
>> @@ -70,6 +70,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags
>>   {
>>   	size_t size = 1UL << shift;
>>   
>> +	entry = pte_mkhuge(entry);
> Could drop that and replace the below by:
> 
> 	if (size == SZ_16K)
> 		return __pte(pte_val(entry) | _PAGE_SPS);
> 	else
> 		return __pte(pte_val(entry) | _PAGE_SPS | _PAGE_HUGE);
> 	
> 

Sure, will change as stated above.

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02  9:38     ` Anshuman Khandual
  0 siblings, 0 replies; 24+ messages in thread
From: Anshuman Khandual @ 2022-02-02  9:38 UTC (permalink / raw)
  To: Christophe Leroy, linux-mm
  Cc: Will Deacon, Catalin Marinas, linux-kernel, Paul Mackerras,
	sparclinux, Andrew Morton, linuxppc-dev, David S. Miller,
	linux-arm-kernel, Mike Kravetz



On 2/2/22 11:50 AM, Christophe Leroy wrote:
> 
> Le 02/02/2022 à 06:38, Anshuman Khandual a écrit :
>> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
>> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
>> This updates generic fallback stub for arch_make_huge_pte() and available
>> platforms definitions. This makes huge pte creation much cleaner and easier
>> to follow.
> I think it is a good cleanup. I always wonder why commit d9ed9faac283 
> ("mm: add new arch_make_huge_pte() method for tile support") didn't move 
> the pte_mkhuge() into arch_make_huge_pte().

+1

> 
> When I implemented arch_make_huge_pte() for powerpc 8xx, in one case 
> arch_make_huge_pte() have to undo the things done by pte_mkhuge(), see below
> 
> As a second step we could probably try to get rid of pte_mkhuge() 
> completely, at least in the core.

Sure.

> 
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: Michael Ellerman <mpe@ellerman.id.au>
>> Cc: Paul Mackerras <paulus@samba.org>
>> Cc: "David S. Miller" <davem@davemloft.net>
>> Cc: Mike Kravetz <mike.kravetz@oracle.com>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: linuxppc-dev@lists.ozlabs.org
>> Cc: sparclinux@vger.kernel.org
>> Cc: linux-mm@kvack.org
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> 
>> ---
>>   arch/arm64/mm/hugetlbpage.c                      | 1 +
>>   arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
>>   arch/sparc/mm/hugetlbpage.c                      | 1 +
>>   include/linux/hugetlb.h                          | 2 +-
>>   mm/hugetlb.c                                     | 3 +--
>>   mm/vmalloc.c                                     | 1 -
>>   6 files changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
>> index ffb9c229610a..228226c5fa80 100644
>> --- a/arch/arm64/mm/hugetlbpage.c
>> +++ b/arch/arm64/mm/hugetlbpage.c
>> @@ -347,6 +347,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>>   {
>>   	size_t pagesize = 1UL << shift;
>>   
>> +	entry = pte_mkhuge(entry);
>>   	if (pagesize == CONT_PTE_SIZE) {
>>   		entry = pte_mkcont(entry);
>>   	} else if (pagesize == CONT_PMD_SIZE) {
>> diff --git a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
>> index 64b6c608eca4..e41e095158c7 100644
>> --- a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
>> +++ b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
>> @@ -70,6 +70,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags
>>   {
>>   	size_t size = 1UL << shift;
>>   
>> +	entry = pte_mkhuge(entry);
> Could drop that and replace the below by:
> 
> 	if (size == SZ_16K)
> 		return __pte(pte_val(entry) | _PAGE_SPS);
> 	else
> 		return __pte(pte_val(entry) | _PAGE_SPS | _PAGE_HUGE);
> 	
> 

Sure, will change as stated above.

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02  9:38     ` Anshuman Khandual
  0 siblings, 0 replies; 24+ messages in thread
From: Anshuman Khandual @ 2022-02-02  9:38 UTC (permalink / raw)
  To: Christophe Leroy, linux-mm
  Cc: Catalin Marinas, linuxppc-dev, linux-kernel, Paul Mackerras,
	sparclinux, Andrew Morton, Will Deacon, David S. Miller,
	linux-arm-kernel, Mike Kravetz



On 2/2/22 11:50 AM, Christophe Leroy wrote:
> 
> Le 02/02/2022 à 06:38, Anshuman Khandual a écrit :
>> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
>> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
>> This updates generic fallback stub for arch_make_huge_pte() and available
>> platforms definitions. This makes huge pte creation much cleaner and easier
>> to follow.
> I think it is a good cleanup. I always wonder why commit d9ed9faac283 
> ("mm: add new arch_make_huge_pte() method for tile support") didn't move 
> the pte_mkhuge() into arch_make_huge_pte().

+1

> 
> When I implemented arch_make_huge_pte() for powerpc 8xx, in one case 
> arch_make_huge_pte() have to undo the things done by pte_mkhuge(), see below
> 
> As a second step we could probably try to get rid of pte_mkhuge() 
> completely, at least in the core.

Sure.

> 
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: Michael Ellerman <mpe@ellerman.id.au>
>> Cc: Paul Mackerras <paulus@samba.org>
>> Cc: "David S. Miller" <davem@davemloft.net>
>> Cc: Mike Kravetz <mike.kravetz@oracle.com>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: linuxppc-dev@lists.ozlabs.org
>> Cc: sparclinux@vger.kernel.org
>> Cc: linux-mm@kvack.org
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> 
>> ---
>>   arch/arm64/mm/hugetlbpage.c                      | 1 +
>>   arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
>>   arch/sparc/mm/hugetlbpage.c                      | 1 +
>>   include/linux/hugetlb.h                          | 2 +-
>>   mm/hugetlb.c                                     | 3 +--
>>   mm/vmalloc.c                                     | 1 -
>>   6 files changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
>> index ffb9c229610a..228226c5fa80 100644
>> --- a/arch/arm64/mm/hugetlbpage.c
>> +++ b/arch/arm64/mm/hugetlbpage.c
>> @@ -347,6 +347,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
>>   {
>>   	size_t pagesize = 1UL << shift;
>>   
>> +	entry = pte_mkhuge(entry);
>>   	if (pagesize == CONT_PTE_SIZE) {
>>   		entry = pte_mkcont(entry);
>>   	} else if (pagesize == CONT_PMD_SIZE) {
>> diff --git a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
>> index 64b6c608eca4..e41e095158c7 100644
>> --- a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
>> +++ b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h
>> @@ -70,6 +70,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags
>>   {
>>   	size_t size = 1UL << shift;
>>   
>> +	entry = pte_mkhuge(entry);
> Could drop that and replace the below by:
> 
> 	if (size == SZ_16K)
> 		return __pte(pte_val(entry) | _PAGE_SPS);
> 	else
> 		return __pte(pte_val(entry) | _PAGE_SPS | _PAGE_HUGE);
> 	
> 

Sure, will change as stated above.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
  2022-02-02  5:38 ` Anshuman Khandual
  (?)
@ 2022-02-02 23:36   ` Mike Kravetz
  -1 siblings, 0 replies; 24+ messages in thread
From: Mike Kravetz @ 2022-02-02 23:36 UTC (permalink / raw)
  To: Anshuman Khandual, linux-mm
  Cc: Catalin Marinas, Will Deacon, Michael Ellerman, Paul Mackerras,
	David S. Miller, Andrew Morton, linux-arm-kernel, linuxppc-dev,
	sparclinux, linux-kernel

On 2/1/22 21:38, Anshuman Khandual wrote:
> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> This updates generic fallback stub for arch_make_huge_pte() and available
> platforms definitions. This makes huge pte creation much cleaner and easier
> to follow.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  arch/arm64/mm/hugetlbpage.c                      | 1 +
>  arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
>  arch/sparc/mm/hugetlbpage.c                      | 1 +
>  include/linux/hugetlb.h                          | 2 +-
>  mm/hugetlb.c                                     | 3 +--
>  mm/vmalloc.c                                     | 1 -
>  6 files changed, 5 insertions(+), 4 deletions(-)

Seems like a reasonable cleanup/simplification to me.

Acked-by: Mike Kravetz <mike.kravetz@oracle.com>

-- 
Mike Kravetz

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02 23:36   ` Mike Kravetz
  0 siblings, 0 replies; 24+ messages in thread
From: Mike Kravetz @ 2022-02-02 23:36 UTC (permalink / raw)
  To: Anshuman Khandual, linux-mm
  Cc: Catalin Marinas, linuxppc-dev, linux-kernel, Paul Mackerras,
	sparclinux, Andrew Morton, Will Deacon, David S. Miller,
	linux-arm-kernel

On 2/1/22 21:38, Anshuman Khandual wrote:
> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> This updates generic fallback stub for arch_make_huge_pte() and available
> platforms definitions. This makes huge pte creation much cleaner and easier
> to follow.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  arch/arm64/mm/hugetlbpage.c                      | 1 +
>  arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
>  arch/sparc/mm/hugetlbpage.c                      | 1 +
>  include/linux/hugetlb.h                          | 2 +-
>  mm/hugetlb.c                                     | 3 +--
>  mm/vmalloc.c                                     | 1 -
>  6 files changed, 5 insertions(+), 4 deletions(-)

Seems like a reasonable cleanup/simplification to me.

Acked-by: Mike Kravetz <mike.kravetz@oracle.com>

-- 
Mike Kravetz

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-02 23:36   ` Mike Kravetz
  0 siblings, 0 replies; 24+ messages in thread
From: Mike Kravetz @ 2022-02-02 23:36 UTC (permalink / raw)
  To: Anshuman Khandual, linux-mm
  Cc: Catalin Marinas, Will Deacon, Michael Ellerman, Paul Mackerras,
	David S. Miller, Andrew Morton, linux-arm-kernel, linuxppc-dev,
	sparclinux, linux-kernel

On 2/1/22 21:38, Anshuman Khandual wrote:
> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> This updates generic fallback stub for arch_make_huge_pte() and available
> platforms definitions. This makes huge pte creation much cleaner and easier
> to follow.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  arch/arm64/mm/hugetlbpage.c                      | 1 +
>  arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 +
>  arch/sparc/mm/hugetlbpage.c                      | 1 +
>  include/linux/hugetlb.h                          | 2 +-
>  mm/hugetlb.c                                     | 3 +--
>  mm/vmalloc.c                                     | 1 -
>  6 files changed, 5 insertions(+), 4 deletions(-)

Seems like a reasonable cleanup/simplification to me.

Acked-by: Mike Kravetz <mike.kravetz@oracle.com>

-- 
Mike Kravetz

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
  2022-02-02  5:38 ` Anshuman Khandual
  (?)
@ 2022-02-03 17:51   ` Catalin Marinas
  -1 siblings, 0 replies; 24+ messages in thread
From: Catalin Marinas @ 2022-02-03 17:51 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, Will Deacon, Michael Ellerman, Paul Mackerras,
	David S. Miller, Mike Kravetz, Andrew Morton, linux-arm-kernel,
	linuxppc-dev, sparclinux, linux-kernel

On Wed, Feb 02, 2022 at 11:08:06AM +0530, Anshuman Khandual wrote:
> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> This updates generic fallback stub for arch_make_huge_pte() and available
> platforms definitions. This makes huge pte creation much cleaner and easier
> to follow.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

For arm64:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-03 17:51   ` Catalin Marinas
  0 siblings, 0 replies; 24+ messages in thread
From: Catalin Marinas @ 2022-02-03 17:51 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linuxppc-dev, linux-kernel, linux-mm, Paul Mackerras, sparclinux,
	Andrew Morton, Will Deacon, David S. Miller, linux-arm-kernel,
	Mike Kravetz

On Wed, Feb 02, 2022 at 11:08:06AM +0530, Anshuman Khandual wrote:
> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> This updates generic fallback stub for arch_make_huge_pte() and available
> platforms definitions. This makes huge pte creation much cleaner and easier
> to follow.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

For arm64:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

* Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte()
@ 2022-02-03 17:51   ` Catalin Marinas
  0 siblings, 0 replies; 24+ messages in thread
From: Catalin Marinas @ 2022-02-03 17:51 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, Will Deacon, Michael Ellerman, Paul Mackerras,
	David S. Miller, Mike Kravetz, Andrew Morton, linux-arm-kernel,
	linuxppc-dev, sparclinux, linux-kernel

On Wed, Feb 02, 2022 at 11:08:06AM +0530, Anshuman Khandual wrote:
> Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte().
> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning.
> This updates generic fallback stub for arch_make_huge_pte() and available
> platforms definitions. This makes huge pte creation much cleaner and easier
> to follow.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

For arm64:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-02-03 18:05 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02  5:38 [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte() Anshuman Khandual
2022-02-02  5:38 ` Anshuman Khandual
2022-02-02  5:38 ` Anshuman Khandual
2022-02-02  6:18 ` Mike Rapoport
2022-02-02  6:18   ` Mike Rapoport
2022-02-02  6:18   ` Mike Rapoport
2022-02-02  6:25   ` Christophe Leroy
2022-02-02  6:25     ` Christophe Leroy
2022-02-02  6:25     ` Christophe Leroy
2022-02-02  7:37     ` Mike Rapoport
2022-02-02  7:37       ` Mike Rapoport
2022-02-02  7:37       ` Mike Rapoport
2022-02-02  6:20 ` Christophe Leroy
2022-02-02  6:20   ` Christophe Leroy
2022-02-02  6:20   ` Christophe Leroy
2022-02-02  9:38   ` Anshuman Khandual
2022-02-02  9:38     ` Anshuman Khandual
2022-02-02  9:38     ` Anshuman Khandual
2022-02-02 23:36 ` Mike Kravetz
2022-02-02 23:36   ` Mike Kravetz
2022-02-02 23:36   ` Mike Kravetz
2022-02-03 17:51 ` Catalin Marinas
2022-02-03 17:51   ` Catalin Marinas
2022-02-03 17:51   ` Catalin Marinas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.