[PATCH v2 12/14] mm/treewide: Remove pXd_huge()

2024-03-18 Thread peterx
From: Peter Xu 

This API is not used anymore, drop it for the whole tree.

Signed-off-by: Peter Xu 
---
 arch/arm/mm/Makefile  |  1 -
 arch/arm/mm/hugetlbpage.c | 29 ---
 arch/arm64/mm/hugetlbpage.c   | 10 ---
 arch/loongarch/mm/hugetlbpage.c   | 10 ---
 arch/mips/include/asm/pgtable-32.h|  2 +-
 arch/mips/include/asm/pgtable-64.h|  2 +-
 arch/mips/mm/hugetlbpage.c| 10 ---
 arch/parisc/mm/hugetlbpage.c  | 11 ---
 .../include/asm/book3s/64/pgtable-4k.h| 10 ---
 .../include/asm/book3s/64/pgtable-64k.h   | 25 
 arch/powerpc/include/asm/nohash/pgtable.h | 10 ---
 arch/riscv/mm/hugetlbpage.c   | 10 ---
 arch/s390/mm/hugetlbpage.c| 10 ---
 arch/sh/mm/hugetlbpage.c  | 10 ---
 arch/sparc/mm/hugetlbpage.c   | 10 ---
 arch/x86/mm/hugetlbpage.c | 16 --
 include/linux/hugetlb.h   | 24 ---
 17 files changed, 2 insertions(+), 198 deletions(-)
 delete mode 100644 arch/arm/mm/hugetlbpage.c

diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index 71b858c9b10c..1779e12db085 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -21,7 +21,6 @@ KASAN_SANITIZE_physaddr.o := n
 obj-$(CONFIG_DEBUG_VIRTUAL)+= physaddr.o
 
 obj-$(CONFIG_ALIGNMENT_TRAP)   += alignment.o
-obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
 obj-$(CONFIG_ARM_PV_FIXUP) += pv-fixup-asm.o
 
 obj-$(CONFIG_CPU_ABRT_NOMMU)   += abort-nommu.o
diff --git a/arch/arm/mm/hugetlbpage.c b/arch/arm/mm/hugetlbpage.c
deleted file mode 100644
index c2fa643f6bb5..
--- a/arch/arm/mm/hugetlbpage.c
+++ /dev/null
@@ -1,29 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * arch/arm/mm/hugetlbpage.c
- *
- * Copyright (C) 2012 ARM Ltd.
- *
- * Based on arch/x86/include/asm/hugetlb.h and Bill Carson's patches
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-int pud_huge(pud_t pud)
-{
-   return 0;
-}
-
-int pmd_huge(pmd_t pmd)
-{
-   return pmd_leaf(pmd);
-}
diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index f494fc31201f..ca58210d6c07 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -79,16 +79,6 @@ bool arch_hugetlb_migration_supported(struct hstate *h)
 }
 #endif
 
-int pmd_huge(pmd_t pmd)
-{
-   return pmd_leaf(pmd);
-}
-
-int pud_huge(pud_t pud)
-{
-   return pud_leaf(pud);
-}
-
 static int find_num_contig(struct mm_struct *mm, unsigned long addr,
   pte_t *ptep, size_t *pgsize)
 {
diff --git a/arch/loongarch/mm/hugetlbpage.c b/arch/loongarch/mm/hugetlbpage.c
index a4e78e74aa21..1c56cb59 100644
--- a/arch/loongarch/mm/hugetlbpage.c
+++ b/arch/loongarch/mm/hugetlbpage.c
@@ -50,16 +50,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long 
addr,
return (pte_t *) pmd;
 }
 
-int pmd_huge(pmd_t pmd)
-{
-   return (pmd_val(pmd) & _PAGE_HUGE) != 0;
-}
-
-int pud_huge(pud_t pud)
-{
-   return (pud_val(pud) & _PAGE_HUGE) != 0;
-}
-
 uint64_t pmd_to_entrylo(unsigned long pmd_val)
 {
uint64_t val;
diff --git a/arch/mips/include/asm/pgtable-32.h 
b/arch/mips/include/asm/pgtable-32.h
index 0e196650f4f4..92b7591aac2a 100644
--- a/arch/mips/include/asm/pgtable-32.h
+++ b/arch/mips/include/asm/pgtable-32.h
@@ -129,7 +129,7 @@ static inline int pmd_none(pmd_t pmd)
 static inline int pmd_bad(pmd_t pmd)
 {
 #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
-   /* pmd_huge(pmd) but inline */
+   /* pmd_leaf(pmd) but inline */
if (unlikely(pmd_val(pmd) & _PAGE_HUGE))
return 0;
 #endif
diff --git a/arch/mips/include/asm/pgtable-64.h 
b/arch/mips/include/asm/pgtable-64.h
index 20ca48c1b606..7c28510b3768 100644
--- a/arch/mips/include/asm/pgtable-64.h
+++ b/arch/mips/include/asm/pgtable-64.h
@@ -245,7 +245,7 @@ static inline int pmd_none(pmd_t pmd)
 static inline int pmd_bad(pmd_t pmd)
 {
 #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
-   /* pmd_huge(pmd) but inline */
+   /* pmd_leaf(pmd) but inline */
if (unlikely(pmd_val(pmd) & _PAGE_HUGE))
return 0;
 #endif
diff --git a/arch/mips/mm/hugetlbpage.c b/arch/mips/mm/hugetlbpage.c
index 7eaff5b07873..0b9e1b59 100644
--- a/arch/mips/mm/hugetlbpage.c
+++ b/arch/mips/mm/hugetlbpage.c
@@ -57,13 +57,3 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long 
addr,
}
return (pte_t *) pmd;
 }
-
-int pmd_huge(pmd_t pmd)
-{
-   return (pmd_val(pmd) & _PAGE_HUGE) != 0;
-}
-
-int pud_huge(pud_t pud)
-{
-   return (pud_val(pud) & _PAGE_HUGE) != 0;
-}
diff --git a/arch/parisc/mm/hugetlbpage.c b/arch/parisc/mm/hugetlbpage.c
index a9f7e21f6656..0356199bd9e7 100644
--- a/arch/parisc/mm/hugetlbpage.c
+++ b

Re: [PATCH v2 12/14] mm/treewide: Remove pXd_huge()

2024-05-26 Thread Christophe Leroy


Le 18/03/2024 à 21:04, pet...@redhat.com a écrit :
> From: Peter Xu 
> 
> This API is not used anymore, drop it for the whole tree.

Some documentation remain in v6.10-rc1:

$ git grep -w p.d_huge
Documentation/mm/arch_pgtable_helpers.rst:| pmd_huge  | 
Tests a HugeTLB mapped PMD   |
Documentation/mm/arch_pgtable_helpers.rst:| pud_huge  | 
Tests a HugeTLB mapped PUD   |
arch/x86/mm/pat/set_memory.c:* otherwise 
pmd_present/pmd_huge will return true


Christophe


Re: [PATCH v2 12/14] mm/treewide: Remove pXd_huge()

2024-05-27 Thread Peter Xu
On Mon, May 27, 2024 at 06:03:30AM +, Christophe Leroy wrote:
> 
> 
> Le 18/03/2024 à 21:04, pet...@redhat.com a écrit :
> > From: Peter Xu 
> > 
> > This API is not used anymore, drop it for the whole tree.
> 
> Some documentation remain in v6.10-rc1:
> 
> $ git grep -w p.d_huge
> Documentation/mm/arch_pgtable_helpers.rst:| pmd_huge  | 
> Tests a HugeTLB mapped PMD   |
> Documentation/mm/arch_pgtable_helpers.rst:| pud_huge  | 
> Tests a HugeTLB mapped PUD   |
> arch/x86/mm/pat/set_memory.c:* otherwise 
> pmd_present/pmd_huge will return true

True, I'll send a patch, thanks.

-- 
Peter Xu