[PATCH 3/3] riscv: mm: use xchg() on non-atomic_long_t variables, not atomic_long_xchg()
Paul Walmsley
pjw at kernel.org
Wed Nov 19 20:18:30 PST 2025
Let's not call atomic_long_xchg() on something that's not an
atomic_long_t, and just use xchg() instead. Continues the cleanup
from commit 546e42c8c6d94 ("riscv: Use an atomic xchg in
pudp_huge_get_and_clear()"),
Cc: Alexandre Ghiti <alex at ghiti.fr>
Signed-off-by: Paul Walmsley <pjw at kernel.org>
---
arch/riscv/include/asm/pgtable.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index e1610d031199..a1ffa502739b 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -591,7 +591,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
unsigned long address, pte_t *ptep)
{
#ifdef CONFIG_SMP
- pte_t pte = __pte(atomic_long_xchg((atomic_long_t *)ptep, 0));
+ pte_t pte = __pte(xchg(&ptep->pte, 0));
#else
pte_t pte = *ptep;
@@ -868,7 +868,7 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
unsigned long address, pmd_t *pmdp)
{
#ifdef CONFIG_SMP
- pmd_t pmd = __pmd(atomic_long_xchg((atomic_long_t *)pmdp, 0));
+ pmd_t pmd = __pmd(xchg(&pmdp->pmd, 0));
#else
pmd_t pmd = *pmdp;
--
2.48.1
More information about the linux-riscv
mailing list