Skip to content

Commit 2f709f7

Browse files
xzpeterakpm00
authored andcommitted
mm/treewide: replace pmd_large() with pmd_leaf()
pmd_large() is always defined as pmd_leaf(). Merge their usages. Chose pmd_leaf() because pmd_leaf() is a global API, while pmd_large() is not. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Peter Xu <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Mike Rapoport (IBM) <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Andrey Konovalov <[email protected]> Cc: Andrey Ryabinin <[email protected]> Cc: "Aneesh Kumar K.V" <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Kirill A. Shutemov <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Muchun Song <[email protected]> Cc: "Naveen N. Rao" <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vincenzo Frascino <[email protected]> Cc: Yang Shi <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent b6c9d5a commit 2f709f7

File tree

25 files changed

+49
-49
lines changed

25 files changed

+49
-49
lines changed

arch/arm/mm/dump.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,12 @@ static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start)
349349
for (i = 0; i < PTRS_PER_PMD; i++, pmd++) {
350350
addr = start + i * PMD_SIZE;
351351
domain = get_domain_name(pmd);
352-
if (pmd_none(*pmd) || pmd_large(*pmd) || !pmd_present(*pmd))
352+
if (pmd_none(*pmd) || pmd_leaf(*pmd) || !pmd_present(*pmd))
353353
note_page(st, addr, 4, pmd_val(*pmd), domain);
354354
else
355355
walk_pte(st, pmd, addr, domain);
356356

357-
if (SECTION_SIZE < PMD_SIZE && pmd_large(pmd[1])) {
357+
if (SECTION_SIZE < PMD_SIZE && pmd_leaf(pmd[1])) {
358358
addr += SECTION_SIZE;
359359
pmd++;
360360
domain = get_domain_name(pmd);

arch/powerpc/mm/book3s64/pgtable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
113113

114114
WARN_ON(pte_hw_valid(pmd_pte(*pmdp)) && !pte_protnone(pmd_pte(*pmdp)));
115115
assert_spin_locked(pmd_lockptr(mm, pmdp));
116-
WARN_ON(!(pmd_large(pmd)));
116+
WARN_ON(!(pmd_leaf(pmd)));
117117
#endif
118118
trace_hugepage_set_pmd(addr, pmd_val(pmd));
119119
return set_pte_at(mm, addr, pmdp_ptep(pmdp), pmd_pte(pmd));

arch/powerpc/mm/book3s64/radix_pgtable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ bool vmemmap_can_optimize(struct vmem_altmap *altmap, struct dev_pagemap *pgmap)
924924
int __meminit vmemmap_check_pmd(pmd_t *pmdp, int node,
925925
unsigned long addr, unsigned long next)
926926
{
927-
int large = pmd_large(*pmdp);
927+
int large = pmd_leaf(*pmdp);
928928

929929
if (large)
930930
vmemmap_verify(pmdp_ptep(pmdp), node, addr, next);

arch/powerpc/mm/pgtable_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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_large(pmd) || pmd_huge(pmd)));
135+
VM_WARN_ON(!(pmd_leaf(pmd) || pmd_huge(pmd)));
136136
return pte_page(pmd_pte(pmd));
137137
}
138138
return virt_to_page(pmd_page_vaddr(pmd));

arch/s390/boot/vmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static void pgtable_pmd_populate(pud_t *pud, unsigned long addr, unsigned long e
333333
}
334334
pte = boot_pte_alloc();
335335
pmd_populate(&init_mm, pmd, pte);
336-
} else if (pmd_large(*pmd)) {
336+
} else if (pmd_leaf(*pmd)) {
337337
continue;
338338
}
339339
pgtable_pte_populate(pmd, addr, next, mode);

arch/s390/include/asm/pgtable.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ static inline int pmd_large(pmd_t pmd)
721721

722722
static inline int pmd_bad(pmd_t pmd)
723723
{
724-
if ((pmd_val(pmd) & _SEGMENT_ENTRY_TYPE_MASK) > 0 || pmd_large(pmd))
724+
if ((pmd_val(pmd) & _SEGMENT_ENTRY_TYPE_MASK) > 0 || pmd_leaf(pmd))
725725
return 1;
726726
return (pmd_val(pmd) & ~_SEGMENT_ENTRY_BITS) != 0;
727727
}
@@ -820,8 +820,8 @@ static inline int pte_protnone(pte_t pte)
820820

821821
static inline int pmd_protnone(pmd_t pmd)
822822
{
823-
/* pmd_large(pmd) implies pmd_present(pmd) */
824-
return pmd_large(pmd) && !(pmd_val(pmd) & _SEGMENT_ENTRY_READ);
823+
/* pmd_leaf(pmd) implies pmd_present(pmd) */
824+
return pmd_leaf(pmd) && !(pmd_val(pmd) & _SEGMENT_ENTRY_READ);
825825
}
826826
#endif
827827

@@ -1385,7 +1385,7 @@ static inline unsigned long pmd_deref(pmd_t pmd)
13851385
unsigned long origin_mask;
13861386

13871387
origin_mask = _SEGMENT_ENTRY_ORIGIN;
1388-
if (pmd_large(pmd))
1388+
if (pmd_leaf(pmd))
13891389
origin_mask = _SEGMENT_ENTRY_ORIGIN_LARGE;
13901390
return (unsigned long)__va(pmd_val(pmd) & origin_mask);
13911391
}

arch/s390/mm/gmap.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ int __gmap_link(struct gmap *gmap, unsigned long gaddr, unsigned long vmaddr)
603603
pmd = pmd_offset(pud, vmaddr);
604604
VM_BUG_ON(pmd_none(*pmd));
605605
/* Are we allowed to use huge pages? */
606-
if (pmd_large(*pmd) && !gmap->mm->context.allow_gmap_hpage_1m)
606+
if (pmd_leaf(*pmd) && !gmap->mm->context.allow_gmap_hpage_1m)
607607
return -EFAULT;
608608
/* Link gmap segment table entry location to page table. */
609609
rc = radix_tree_preload(GFP_KERNEL_ACCOUNT);
@@ -615,7 +615,7 @@ int __gmap_link(struct gmap *gmap, unsigned long gaddr, unsigned long vmaddr)
615615
rc = radix_tree_insert(&gmap->host_to_guest,
616616
vmaddr >> PMD_SHIFT, table);
617617
if (!rc) {
618-
if (pmd_large(*pmd)) {
618+
if (pmd_leaf(*pmd)) {
619619
*table = (pmd_val(*pmd) &
620620
_SEGMENT_ENTRY_HARDWARE_BITS_LARGE)
621621
| _SEGMENT_ENTRY_GMAP_UC;
@@ -945,7 +945,7 @@ static inline pmd_t *gmap_pmd_op_walk(struct gmap *gmap, unsigned long gaddr)
945945
}
946946

947947
/* 4k page table entries are locked via the pte (pte_alloc_map_lock). */
948-
if (!pmd_large(*pmdp))
948+
if (!pmd_leaf(*pmdp))
949949
spin_unlock(&gmap->guest_table_lock);
950950
return pmdp;
951951
}
@@ -957,7 +957,7 @@ static inline pmd_t *gmap_pmd_op_walk(struct gmap *gmap, unsigned long gaddr)
957957
*/
958958
static inline void gmap_pmd_op_end(struct gmap *gmap, pmd_t *pmdp)
959959
{
960-
if (pmd_large(*pmdp))
960+
if (pmd_leaf(*pmdp))
961961
spin_unlock(&gmap->guest_table_lock);
962962
}
963963

@@ -1068,7 +1068,7 @@ static int gmap_protect_range(struct gmap *gmap, unsigned long gaddr,
10681068
rc = -EAGAIN;
10691069
pmdp = gmap_pmd_op_walk(gmap, gaddr);
10701070
if (pmdp) {
1071-
if (!pmd_large(*pmdp)) {
1071+
if (!pmd_leaf(*pmdp)) {
10721072
rc = gmap_protect_pte(gmap, gaddr, pmdp, prot,
10731073
bits);
10741074
if (!rc) {
@@ -2500,7 +2500,7 @@ void gmap_sync_dirty_log_pmd(struct gmap *gmap, unsigned long bitmap[4],
25002500
if (!pmdp)
25012501
return;
25022502

2503-
if (pmd_large(*pmdp)) {
2503+
if (pmd_leaf(*pmdp)) {
25042504
if (gmap_test_and_clear_dirty_pmd(gmap, pmdp, gaddr))
25052505
bitmap_fill(bitmap, _PAGE_ENTRIES);
25062506
} else {

arch/s390/mm/hugetlbpage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ pte_t *huge_pte_offset(struct mm_struct *mm,
235235

236236
int pmd_huge(pmd_t pmd)
237237
{
238-
return pmd_large(pmd);
238+
return pmd_leaf(pmd);
239239
}
240240

241241
int pud_huge(pud_t pud)

arch/s390/mm/pageattr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static int walk_pmd_level(pud_t *pudp, unsigned long addr, unsigned long end,
185185
if (pmd_none(*pmdp))
186186
return -EINVAL;
187187
next = pmd_addr_end(addr, end);
188-
if (pmd_large(*pmdp)) {
188+
if (pmd_leaf(*pmdp)) {
189189
need_split = !!(flags & SET_MEMORY_4K);
190190
need_split |= !!(addr & ~PMD_MASK);
191191
need_split |= !!(addr + PMD_SIZE > next);

arch/s390/mm/pgtable.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
827827
return key ? -EFAULT : 0;
828828
}
829829

830-
if (pmd_large(*pmdp)) {
830+
if (pmd_leaf(*pmdp)) {
831831
paddr = pmd_val(*pmdp) & HPAGE_MASK;
832832
paddr |= addr & ~HPAGE_MASK;
833833
/*
@@ -938,7 +938,7 @@ int reset_guest_reference_bit(struct mm_struct *mm, unsigned long addr)
938938
return 0;
939939
}
940940

941-
if (pmd_large(*pmdp)) {
941+
if (pmd_leaf(*pmdp)) {
942942
paddr = pmd_val(*pmdp) & HPAGE_MASK;
943943
paddr |= addr & ~HPAGE_MASK;
944944
cc = page_reset_referenced(paddr);
@@ -1002,7 +1002,7 @@ int get_guest_storage_key(struct mm_struct *mm, unsigned long addr,
10021002
return 0;
10031003
}
10041004

1005-
if (pmd_large(*pmdp)) {
1005+
if (pmd_leaf(*pmdp)) {
10061006
paddr = pmd_val(*pmdp) & HPAGE_MASK;
10071007
paddr |= addr & ~HPAGE_MASK;
10081008
*key = page_get_storage_key(paddr);

0 commit comments

Comments
 (0)