Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm/treewide: remove pXd_huge()

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

Link: https://lkml.kernel.org/r/20240318200404.448346-13-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Konrad Dybcio <konrad.dybcio@linaro.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Mark Salter <msalter@redhat.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Peter Xu and committed by
Andrew Morton
9636f055 1965e933

+2 -198
-1
arch/arm/mm/Makefile
··· 21 21 obj-$(CONFIG_DEBUG_VIRTUAL) += physaddr.o 22 22 23 23 obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o 24 - obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 25 24 obj-$(CONFIG_ARM_PV_FIXUP) += pv-fixup-asm.o 26 25 27 26 obj-$(CONFIG_CPU_ABRT_NOMMU) += abort-nommu.o
-29
arch/arm/mm/hugetlbpage.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * arch/arm/mm/hugetlbpage.c 4 - * 5 - * Copyright (C) 2012 ARM Ltd. 6 - * 7 - * Based on arch/x86/include/asm/hugetlb.h and Bill Carson's patches 8 - */ 9 - 10 - #include <linux/init.h> 11 - #include <linux/fs.h> 12 - #include <linux/mm.h> 13 - #include <linux/hugetlb.h> 14 - #include <linux/pagemap.h> 15 - #include <linux/err.h> 16 - #include <linux/sysctl.h> 17 - #include <asm/mman.h> 18 - #include <asm/tlb.h> 19 - #include <asm/tlbflush.h> 20 - 21 - int pud_huge(pud_t pud) 22 - { 23 - return 0; 24 - } 25 - 26 - int pmd_huge(pmd_t pmd) 27 - { 28 - return pmd_leaf(pmd); 29 - }
-10
arch/arm64/mm/hugetlbpage.c
··· 79 79 } 80 80 #endif 81 81 82 - int pmd_huge(pmd_t pmd) 83 - { 84 - return pmd_leaf(pmd); 85 - } 86 - 87 - int pud_huge(pud_t pud) 88 - { 89 - return pud_leaf(pud); 90 - } 91 - 92 82 static int find_num_contig(struct mm_struct *mm, unsigned long addr, 93 83 pte_t *ptep, size_t *pgsize) 94 84 {
-10
arch/loongarch/mm/hugetlbpage.c
··· 50 50 return (pte_t *) pmd; 51 51 } 52 52 53 - int pmd_huge(pmd_t pmd) 54 - { 55 - return (pmd_val(pmd) & _PAGE_HUGE) != 0; 56 - } 57 - 58 - int pud_huge(pud_t pud) 59 - { 60 - return (pud_val(pud) & _PAGE_HUGE) != 0; 61 - } 62 - 63 53 uint64_t pmd_to_entrylo(unsigned long pmd_val) 64 54 { 65 55 uint64_t val;
+1 -1
arch/mips/include/asm/pgtable-32.h
··· 129 129 static inline int pmd_bad(pmd_t pmd) 130 130 { 131 131 #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT 132 - /* pmd_huge(pmd) but inline */ 132 + /* pmd_leaf(pmd) but inline */ 133 133 if (unlikely(pmd_val(pmd) & _PAGE_HUGE)) 134 134 return 0; 135 135 #endif
+1 -1
arch/mips/include/asm/pgtable-64.h
··· 245 245 static inline int pmd_bad(pmd_t pmd) 246 246 { 247 247 #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT 248 - /* pmd_huge(pmd) but inline */ 248 + /* pmd_leaf(pmd) but inline */ 249 249 if (unlikely(pmd_val(pmd) & _PAGE_HUGE)) 250 250 return 0; 251 251 #endif
-10
arch/mips/mm/hugetlbpage.c
··· 57 57 } 58 58 return (pte_t *) pmd; 59 59 } 60 - 61 - int pmd_huge(pmd_t pmd) 62 - { 63 - return (pmd_val(pmd) & _PAGE_HUGE) != 0; 64 - } 65 - 66 - int pud_huge(pud_t pud) 67 - { 68 - return (pud_val(pud) & _PAGE_HUGE) != 0; 69 - }
-11
arch/parisc/mm/hugetlbpage.c
··· 180 180 } 181 181 return changed; 182 182 } 183 - 184 - 185 - int pmd_huge(pmd_t pmd) 186 - { 187 - return 0; 188 - } 189 - 190 - int pud_huge(pud_t pud) 191 - { 192 - return 0; 193 - }
-10
arch/powerpc/include/asm/book3s/64/pgtable-4k.h
··· 6 6 */ 7 7 #ifndef __ASSEMBLY__ 8 8 #ifdef CONFIG_HUGETLB_PAGE 9 - static inline int pmd_huge(pmd_t pmd) 10 - { 11 - return pmd_leaf(pmd); 12 - } 13 - 14 - static inline int pud_huge(pud_t pud) 15 - { 16 - return pud_leaf(pud); 17 - } 18 - 19 9 /* 20 10 * With radix , we have hugepage ptes in the pud and pmd entries. We don't 21 11 * need to setup hugepage directory for them. Our pte and page directory format
-25
arch/powerpc/include/asm/book3s/64/pgtable-64k.h
··· 4 4 5 5 #ifndef __ASSEMBLY__ 6 6 #ifdef CONFIG_HUGETLB_PAGE 7 - /* 8 - * We have PGD_INDEX_SIZ = 12 and PTE_INDEX_SIZE = 8, so that we can have 9 - * 16GB hugepage pte in PGD and 16MB hugepage pte at PMD; 10 - * 11 - * Defined in such a way that we can optimize away code block at build time 12 - * if CONFIG_HUGETLB_PAGE=n. 13 - * 14 - * returns true for pmd migration entries, THP, devmap, hugetlb 15 - * But compile time dependent on CONFIG_HUGETLB_PAGE 16 - */ 17 - static inline int pmd_huge(pmd_t pmd) 18 - { 19 - /* 20 - * leaf pte for huge page 21 - */ 22 - return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE)); 23 - } 24 - 25 - static inline int pud_huge(pud_t pud) 26 - { 27 - /* 28 - * leaf pte for huge page 29 - */ 30 - return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PTE)); 31 - } 32 7 33 8 /* 34 9 * With 64k page size, we have hugepage ptes in the pgd and pmd entries. We don't
-10
arch/powerpc/include/asm/nohash/pgtable.h
··· 351 351 #endif 352 352 } 353 353 354 - static inline int pmd_huge(pmd_t pmd) 355 - { 356 - return 0; 357 - } 358 - 359 - static inline int pud_huge(pud_t pud) 360 - { 361 - return 0; 362 - } 363 - 364 354 #define is_hugepd(hpd) (hugepd_ok(hpd)) 365 355 #endif 366 356
-10
arch/riscv/mm/hugetlbpage.c
··· 399 399 400 400 #endif /*CONFIG_RISCV_ISA_SVNAPOT*/ 401 401 402 - int pud_huge(pud_t pud) 403 - { 404 - return pud_leaf(pud); 405 - } 406 - 407 - int pmd_huge(pmd_t pmd) 408 - { 409 - return pmd_leaf(pmd); 410 - } 411 - 412 402 static bool __hugetlb_valid_size(unsigned long size) 413 403 { 414 404 if (size == HPAGE_SIZE)
-10
arch/s390/mm/hugetlbpage.c
··· 233 233 return (pte_t *) pmdp; 234 234 } 235 235 236 - int pmd_huge(pmd_t pmd) 237 - { 238 - return pmd_leaf(pmd); 239 - } 240 - 241 - int pud_huge(pud_t pud) 242 - { 243 - return pud_leaf(pud); 244 - } 245 - 246 236 bool __init arch_hugetlb_valid_size(unsigned long size) 247 237 { 248 238 if (MACHINE_HAS_EDAT1 && size == PMD_SIZE)
-10
arch/sh/mm/hugetlbpage.c
··· 70 70 71 71 return pte; 72 72 } 73 - 74 - int pmd_huge(pmd_t pmd) 75 - { 76 - return 0; 77 - } 78 - 79 - int pud_huge(pud_t pud) 80 - { 81 - return 0; 82 - }
-10
arch/sparc/mm/hugetlbpage.c
··· 407 407 return entry; 408 408 } 409 409 410 - int pmd_huge(pmd_t pmd) 411 - { 412 - return pmd_leaf(pmd); 413 - } 414 - 415 - int pud_huge(pud_t pud) 416 - { 417 - return pud_leaf(pud); 418 - } 419 - 420 410 static void hugetlb_free_pte_range(struct mmu_gather *tlb, pmd_t *pmd, 421 411 unsigned long addr) 422 412 {
-16
arch/x86/mm/hugetlbpage.c
··· 19 19 #include <asm/tlbflush.h> 20 20 #include <asm/elf.h> 21 21 22 - /* 23 - * pmd_huge() returns 1 if @pmd is hugetlb related entry. 24 - */ 25 - int pmd_huge(pmd_t pmd) 26 - { 27 - return pmd_leaf(pmd); 28 - } 29 - 30 - /* 31 - * pud_huge() returns 1 if @pud is hugetlb related entry. 32 - */ 33 - int pud_huge(pud_t pud) 34 - { 35 - return pud_leaf(pud); 36 - } 37 - 38 22 #ifdef CONFIG_HUGETLB_PAGE 39 23 static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *file, 40 24 unsigned long addr, unsigned long len,
-24
include/linux/hugetlb.h
··· 272 272 int hugetlb_vma_trylock_write(struct vm_area_struct *vma); 273 273 void hugetlb_vma_assert_locked(struct vm_area_struct *vma); 274 274 void hugetlb_vma_lock_release(struct kref *kref); 275 - 276 - int pmd_huge(pmd_t pmd); 277 - int pud_huge(pud_t pud); 278 275 long hugetlb_change_protection(struct vm_area_struct *vma, 279 276 unsigned long address, unsigned long end, pgprot_t newprot, 280 277 unsigned long cp_flags); 281 - 282 278 bool is_hugetlb_entry_migration(pte_t pte); 283 279 bool is_hugetlb_entry_hwpoisoned(pte_t pte); 284 280 void hugetlb_unshare_all_pmds(struct vm_area_struct *vma); ··· 395 399 { 396 400 } 397 401 398 - static inline int pmd_huge(pmd_t pmd) 399 - { 400 - return 0; 401 - } 402 - 403 - static inline int pud_huge(pud_t pud) 404 - { 405 - return 0; 406 - } 407 - 408 402 static inline int is_hugepage_only_range(struct mm_struct *mm, 409 403 unsigned long addr, unsigned long len) 410 404 { ··· 479 493 static inline void hugetlb_unshare_all_pmds(struct vm_area_struct *vma) { } 480 494 481 495 #endif /* !CONFIG_HUGETLB_PAGE */ 482 - /* 483 - * hugepages at page global directory. If arch support 484 - * hugepages at pgd level, they need to define this. 485 - */ 486 - #ifndef pgd_huge 487 - #define pgd_huge(x) 0 488 - #endif 489 - #ifndef p4d_huge 490 - #define p4d_huge(x) 0 491 - #endif 492 496 493 497 #ifndef pgd_write 494 498 static inline int pgd_write(pgd_t pgd)