Skip to content

Commit 3133287

Browse files
AlexGhitipalmer-dabbelt
authored andcommitted
riscv: Use p*d_leaf macros to define p*d_huge
The newly introduced p*d_leaf macros allow to check if an entry of the page table map to a physical page instead of the next level. To avoid duplication of code, use those macros to determine if a page table entry points to a hugepage. Suggested-by: Paul Walmsley <paul.walmsley@sifive.com> Signed-off-by: Alexandre Ghiti <alex@ghiti.fr> Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
1 parent abc71bf commit 3133287

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

arch/riscv/mm/hugetlbpage.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44

55
int pud_huge(pud_t pud)
66
{
7-
return pud_present(pud) &&
8-
(pud_val(pud) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC));
7+
return pud_leaf(pud);
98
}
109

1110
int pmd_huge(pmd_t pmd)
1211
{
13-
return pmd_present(pmd) &&
14-
(pmd_val(pmd) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC));
12+
return pmd_leaf(pmd);
1513
}
1614

1715
static __init int setup_hugepagesz(char *opt)

0 commit comments

Comments
 (0)