Skip to content

Commit 1e6084d

Browse files
author
Paul Walmsley
committed
riscv: mm: pmdp_huge_get_and_clear(): avoid atomic ops when !CONFIG_SMP
When !CONFIG_SMP, there's no need for atomic operations in pmdp_huge_get_and_clear(), so, similar to what x86 does, let's not use atomics in this case. See also commit 546e42c ("riscv: Use an atomic xchg in pudp_huge_get_and_clear()"). Cc: Alexandre Ghiti <alex@ghiti.fr> Signed-off-by: Paul Walmsley <pjw@kernel.org>
1 parent 818d78b commit 1e6084d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

arch/riscv/include/asm/pgtable.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,13 @@ static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma,
997997
static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
998998
unsigned long address, pmd_t *pmdp)
999999
{
1000+
#ifdef CONFIG_SMP
10001001
pmd_t pmd = __pmd(atomic_long_xchg((atomic_long_t *)pmdp, 0));
1002+
#else
1003+
pmd_t pmd = *pmdp;
1004+
1005+
pmd_clear(pmdp);
1006+
#endif
10011007

10021008
page_table_check_pmd_clear(mm, pmd);
10031009

0 commit comments

Comments
 (0)