[PATCH RFC v2 35/54] LoongArch: drop the huge page handling from set_memory()
From: Mike Rapoport (Microsoft)
Date: Thu Nov 26 2026 - 06:20:30 EST
set_memory() never finds a huge mapping on LoongArch.
The direct map and the kernel image are in the direct mapping windows,
which have no page tables, and set_memory() skips them.
Everything in the vmalloc area is mapped with base pages, because LoongArch
selects neither HAVE_ARCH_HUGE_VMALLOC nor HAVE_ARCH_HUGE_VMAP.
The only huge kernel mapping is the vmemmap, and nothing changes its
protections.
The PGD, P4D, PUD and PMD handlers of the set_memory() page table walk are
dead code. Drop them.
Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
---
arch/loongarch/mm/pageattr.c | 56 --------------------------------------------
1 file changed, 56 deletions(-)
diff --git a/arch/loongarch/mm/pageattr.c b/arch/loongarch/mm/pageattr.c
index 7283059d6e1f..11cea93c7415 100644
--- a/arch/loongarch/mm/pageattr.c
+++ b/arch/loongarch/mm/pageattr.c
@@ -24,58 +24,6 @@ static unsigned long set_pageattr_masks(unsigned long val, struct mm_walk *walk)
return new_val;
}
-static int pageattr_pgd_entry(pgd_t *pgd, unsigned long addr,
- unsigned long next, struct mm_walk *walk)
-{
- pgd_t val = pgdp_get(pgd);
-
- if (pgd_leaf(val)) {
- val = __pgd(set_pageattr_masks(pgd_val(val), walk));
- set_pgd(pgd, val);
- }
-
- return 0;
-}
-
-static int pageattr_p4d_entry(p4d_t *p4d, unsigned long addr,
- unsigned long next, struct mm_walk *walk)
-{
- p4d_t val = p4dp_get(p4d);
-
- if (p4d_leaf(val)) {
- val = __p4d(set_pageattr_masks(p4d_val(val), walk));
- set_p4d(p4d, val);
- }
-
- return 0;
-}
-
-static int pageattr_pud_entry(pud_t *pud, unsigned long addr,
- unsigned long next, struct mm_walk *walk)
-{
- pud_t val = pudp_get(pud);
-
- if (pud_leaf(val)) {
- val = __pud(set_pageattr_masks(pud_val(val), walk));
- set_pud(pud, val);
- }
-
- return 0;
-}
-
-static int pageattr_pmd_entry(pmd_t *pmd, unsigned long addr,
- unsigned long next, struct mm_walk *walk)
-{
- pmd_t val = pmdp_get(pmd);
-
- if (pmd_leaf(val)) {
- val = __pmd(set_pageattr_masks(pmd_val(val), walk));
- set_pmd(pmd, val);
- }
-
- return 0;
-}
-
static int pageattr_pte_entry(pte_t *pte, unsigned long addr,
unsigned long next, struct mm_walk *walk)
{
@@ -94,10 +42,6 @@ static int pageattr_pte_hole(unsigned long addr, unsigned long next,
}
static const struct mm_walk_ops pageattr_ops = {
- .pgd_entry = pageattr_pgd_entry,
- .p4d_entry = pageattr_p4d_entry,
- .pud_entry = pageattr_pud_entry,
- .pmd_entry = pageattr_pmd_entry,
.pte_entry = pageattr_pte_entry,
.pte_hole = pageattr_pte_hole,
.walk_lock = PGWALK_RDLOCK,
--
2.53.0