Skip to content

Commit 1965e93

Browse files
xzpeterakpm00
authored andcommitted
mm/treewide: replace pXd_huge() with pXd_leaf()
Now after we're sure all pXd_huge() definitions are the same as pXd_leaf(), reuse it. Luckily, pXd_huge() isn't widely used. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Peter Xu <[email protected]> Cc: Alistair Popple <[email protected]> Cc: Andreas Larsson <[email protected]> Cc: "Aneesh Kumar K.V" <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Bjorn Andersson <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Dave Hansen <[email protected]> Cc: David S. Miller <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Konrad Dybcio <[email protected]> Cc: Krzysztof Kozlowski <[email protected]> Cc: Lucas Stach <[email protected]> Cc: Mark Salter <[email protected]> Cc: "Matthew Wilcox (Oracle)" <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Mike Rapoport (IBM) <[email protected]> Cc: Muchun Song <[email protected]> Cc: Naoya Horiguchi <[email protected]> Cc: "Naveen N. Rao" <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Russell King <[email protected]> Cc: Shawn Guo <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 7db86dc commit 1965e93

File tree

10 files changed

+15
-15
lines changed

10 files changed

+15
-15
lines changed

arch/arm/include/asm/pgtable-3level.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static inline pte_t pte_mkspecial(pte_t pte)
190190
#define pmd_dirty(pmd) (pmd_isset((pmd), L_PMD_SECT_DIRTY))
191191

192192
#define pmd_hugewillfault(pmd) (!pmd_young(pmd) || !pmd_write(pmd))
193-
#define pmd_thp_or_huge(pmd) (pmd_huge(pmd) || pmd_trans_huge(pmd))
193+
#define pmd_thp_or_huge(pmd) (pmd_leaf(pmd) || pmd_trans_huge(pmd))
194194

195195
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
196196
#define pmd_trans_huge(pmd) (pmd_val(pmd) && !pmd_table(pmd))

arch/arm64/include/asm/pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ static inline pmd_t pmd_mkinvalid(pmd_t pmd)
517517
return pmd;
518518
}
519519

520-
#define pmd_thp_or_huge(pmd) (pmd_huge(pmd) || pmd_trans_huge(pmd))
520+
#define pmd_thp_or_huge(pmd) (pmd_leaf(pmd) || pmd_trans_huge(pmd))
521521

522522
#define pmd_write(pmd) pte_write(pmd_pte(pmd))
523523

arch/arm64/mm/hugetlbpage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ pte_t *huge_pte_offset(struct mm_struct *mm,
321321
if (sz != PUD_SIZE && pud_none(pud))
322322
return NULL;
323323
/* hugepage or swap? */
324-
if (pud_huge(pud) || !pud_present(pud))
324+
if (pud_leaf(pud) || !pud_present(pud))
325325
return (pte_t *)pudp;
326326
/* table; check the next level */
327327

@@ -333,7 +333,7 @@ pte_t *huge_pte_offset(struct mm_struct *mm,
333333
if (!(sz == PMD_SIZE || sz == CONT_PMD_SIZE) &&
334334
pmd_none(pmd))
335335
return NULL;
336-
if (pmd_huge(pmd) || !pmd_present(pmd))
336+
if (pmd_leaf(pmd) || !pmd_present(pmd))
337337
return (pte_t *)pmdp;
338338

339339
if (sz == CONT_PTE_SIZE)

arch/loongarch/mm/hugetlbpage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ uint64_t pmd_to_entrylo(unsigned long pmd_val)
6464
{
6565
uint64_t val;
6666
/* PMD as PTE. Must be huge page */
67-
if (!pmd_huge(__pmd(pmd_val)))
67+
if (!pmd_leaf(__pmd(pmd_val)))
6868
panic("%s", __func__);
6969

7070
val = pmd_val ^ _PAGE_HUGE;

arch/mips/mm/tlb-r4k.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
326326
idx = read_c0_index();
327327
#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
328328
/* this could be a huge page */
329-
if (pmd_huge(*pmdp)) {
329+
if (pmd_leaf(*pmdp)) {
330330
unsigned long lo;
331331
write_c0_pagemask(PM_HUGE_MASK);
332332
ptep = (pte_t *)pmdp;

arch/powerpc/mm/pgtable_64.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ struct page *p4d_page(p4d_t p4d)
102102
{
103103
if (p4d_leaf(p4d)) {
104104
if (!IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMAP))
105-
VM_WARN_ON(!p4d_huge(p4d));
105+
VM_WARN_ON(!p4d_leaf(p4d));
106106
return pte_page(p4d_pte(p4d));
107107
}
108108
return virt_to_page(p4d_pgtable(p4d));
@@ -113,7 +113,7 @@ struct page *pud_page(pud_t pud)
113113
{
114114
if (pud_leaf(pud)) {
115115
if (!IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMAP))
116-
VM_WARN_ON(!pud_huge(pud));
116+
VM_WARN_ON(!pud_leaf(pud));
117117
return pte_page(pud_pte(pud));
118118
}
119119
return virt_to_page(pud_pgtable(pud));
@@ -132,7 +132,7 @@ struct page *pmd_page(pmd_t pmd)
132132
* enabled so these checks can't be used.
133133
*/
134134
if (!IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMAP))
135-
VM_WARN_ON(!(pmd_leaf(pmd) || pmd_huge(pmd)));
135+
VM_WARN_ON(!pmd_leaf(pmd));
136136
return pte_page(pmd_pte(pmd));
137137
}
138138
return virt_to_page(pmd_page_vaddr(pmd));

arch/x86/mm/pgtable.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot)
731731
return 0;
732732

733733
/* Bail out if we are we on a populated non-leaf entry: */
734-
if (pud_present(*pud) && !pud_huge(*pud))
734+
if (pud_present(*pud) && !pud_leaf(*pud))
735735
return 0;
736736

737737
set_pte((pte_t *)pud, pfn_pte(
@@ -760,7 +760,7 @@ int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot)
760760
}
761761

762762
/* Bail out if we are we on a populated non-leaf entry: */
763-
if (pmd_present(*pmd) && !pmd_huge(*pmd))
763+
if (pmd_present(*pmd) && !pmd_leaf(*pmd))
764764
return 0;
765765

766766
set_pte((pte_t *)pmd, pfn_pte(

mm/gup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ static struct page *follow_p4d_mask(struct vm_area_struct *vma,
778778
p4d = READ_ONCE(*p4dp);
779779
if (!p4d_present(p4d))
780780
return no_page_table(vma, flags);
781-
BUILD_BUG_ON(p4d_huge(p4d));
781+
BUILD_BUG_ON(p4d_leaf(p4d));
782782
if (unlikely(p4d_bad(p4d)))
783783
return no_page_table(vma, flags);
784784

@@ -3082,7 +3082,7 @@ static int gup_p4d_range(pgd_t *pgdp, pgd_t pgd, unsigned long addr, unsigned lo
30823082
next = p4d_addr_end(addr, end);
30833083
if (!p4d_present(p4d))
30843084
return 0;
3085-
BUILD_BUG_ON(p4d_huge(p4d));
3085+
BUILD_BUG_ON(p4d_leaf(p4d));
30863086
if (unlikely(is_hugepd(__hugepd(p4d_val(p4d))))) {
30873087
if (!gup_huge_pd(__hugepd(p4d_val(p4d)), addr,
30883088
P4D_SHIFT, next, flags, pages, nr))

mm/hmm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static int hmm_vma_walk_pud(pud_t *pudp, unsigned long start, unsigned long end,
429429
return hmm_vma_walk_hole(start, end, -1, walk);
430430
}
431431

432-
if (pud_huge(pud) && pud_devmap(pud)) {
432+
if (pud_leaf(pud) && pud_devmap(pud)) {
433433
unsigned long i, npages, pfn;
434434
unsigned int required_fault;
435435
unsigned long *hmm_pfns;

mm/memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2765,7 +2765,7 @@ static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud,
27652765
unsigned long next;
27662766
int err = 0;
27672767

2768-
BUG_ON(pud_huge(*pud));
2768+
BUG_ON(pud_leaf(*pud));
27692769

27702770
if (create) {
27712771
pmd = pmd_alloc_track(mm, pud, addr, mask);

0 commit comments

Comments
 (0)