Skip to content

Commit 7a9b8bd

Browse files
Peter Zijlstrahansendc
authored andcommitted
x86/mm/pae: Don't (ab)use atomic64
PAE implies CX8, write readable code. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/20221022114424.971450128%40infradead.org
1 parent 1180e73 commit 7a9b8bd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

arch/x86/include/asm/pgtable-3level.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#ifndef _ASM_X86_PGTABLE_3LEVEL_H
33
#define _ASM_X86_PGTABLE_3LEVEL_H
44

5-
#include <asm/atomic64_32.h>
6-
75
/*
86
* Intel Physical Address Extension (PAE) Mode - three-level page
97
* tables on PPro+ CPUs.
@@ -95,11 +93,12 @@ static inline void pud_clear(pud_t *pudp)
9593
#ifdef CONFIG_SMP
9694
static inline pte_t native_ptep_get_and_clear(pte_t *ptep)
9795
{
98-
pte_t res;
96+
pte_t old = *ptep;
9997

100-
res.pte = (pteval_t)arch_atomic64_xchg((atomic64_t *)ptep, 0);
98+
do {
99+
} while (!try_cmpxchg64(&ptep->pte, &old.pte, 0ULL));
101100

102-
return res;
101+
return old;
103102
}
104103
#else
105104
#define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp)

0 commit comments

Comments
 (0)