Skip to content

Commit 1180e73

Browse files
Peter Zijlstrahansendc
authored andcommitted
mm/gup: Fix the lockless PMD access
On architectures where the PTE/PMD is larger than the native word size (i386-PAE for example), READ_ONCE() can do the wrong thing. Use pmdp_get_lockless() just like we use ptep_get_lockless(). Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/20221022114424.906110403%40infradead.org
1 parent dab6e71 commit 1180e73

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

kernel/events/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7306,7 +7306,7 @@ static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr)
73067306
return pud_leaf_size(pud);
73077307

73087308
pmdp = pmd_offset_lockless(pudp, pud, addr);
7309-
pmd = READ_ONCE(*pmdp);
7309+
pmd = pmdp_get_lockless(pmdp);
73107310
if (!pmd_present(pmd))
73117311
return 0;
73127312

mm/gup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2808,7 +2808,7 @@ static int gup_pmd_range(pud_t *pudp, pud_t pud, unsigned long addr, unsigned lo
28082808

28092809
pmdp = pmd_offset_lockless(pudp, pud, addr);
28102810
do {
2811-
pmd_t pmd = READ_ONCE(*pmdp);
2811+
pmd_t pmd = pmdp_get_lockless(pmdp);
28122812

28132813
next = pmd_addr_end(addr, end);
28142814
if (!pmd_present(pmd))

0 commit comments

Comments
 (0)