diff options
author | Huacai Chen <chenhuacai@loongson.cn> | 2024-08-07 17:37:11 +0800 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2024-08-07 17:37:11 +0800 |
commit | 4574815abf43e2bf05643e1b3f7a2e5d6df894f0 (patch) | |
tree | c4f114dabbaa5c9529dd5d0c9a5e97837a564785 /arch/loongarch/mm/hugetlbpage.c | |
parent | e688c220732e518c2eb1639e9ef77d4a9311713c (diff) |
LoongArch: Use accessors to page table entries instead of direct dereference
As very well explained in commit 20a004e7b017cce282 ("arm64: mm: Use
READ_ONCE/WRITE_ONCE when accessing page tables"), an architecture whose
page table walker can modify the PTE in parallel must use READ_ONCE()/
WRITE_ONCE() macro to avoid any compiler transformation.
So apply that to LoongArch which is such an architecture, in order to
avoid potential problems.
Similar to commit edf955647269422e ("riscv: Use accessors to page table
entries instead of direct dereference").
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/mm/hugetlbpage.c')
-rw-r--r-- | arch/loongarch/mm/hugetlbpage.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/loongarch/mm/hugetlbpage.c b/arch/loongarch/mm/hugetlbpage.c index 12222c56cb59..e4068906143b 100644 --- a/arch/loongarch/mm/hugetlbpage.c +++ b/arch/loongarch/mm/hugetlbpage.c @@ -39,11 +39,11 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr, pmd_t *pmd = NULL; pgd = pgd_offset(mm, addr); - if (pgd_present(*pgd)) { + if (pgd_present(pgdp_get(pgd))) { p4d = p4d_offset(pgd, addr); - if (p4d_present(*p4d)) { + if (p4d_present(p4dp_get(p4d))) { pud = pud_offset(p4d, addr); - if (pud_present(*pud)) + if (pud_present(pudp_get(pud))) pmd = pmd_offset(pud, addr); } } |