aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/gup.c2
-rw-r--r--mm/memory.c11
-rw-r--r--mm/rmap.c3
3 files changed, 13 insertions, 3 deletions
diff --git a/mm/gup.c b/mm/gup.c
index 0ca1df9075ab..a900759cc807 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -968,7 +968,7 @@ static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
968 968
969 pudp = pud_offset(&pgd, addr); 969 pudp = pud_offset(&pgd, addr);
970 do { 970 do {
971 pud_t pud = ACCESS_ONCE(*pudp); 971 pud_t pud = READ_ONCE(*pudp);
972 972
973 next = pud_addr_end(addr, end); 973 next = pud_addr_end(addr, end);
974 if (pud_none(pud)) 974 if (pud_none(pud))
diff --git a/mm/memory.c b/mm/memory.c
index d8aebc52265f..649e7d440bd7 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3195,7 +3195,16 @@ static int handle_pte_fault(struct mm_struct *mm,
3195 pte_t entry; 3195 pte_t entry;
3196 spinlock_t *ptl; 3196 spinlock_t *ptl;
3197 3197
3198 entry = ACCESS_ONCE(*pte); 3198 /*
3199 * some architectures can have larger ptes than wordsize,
3200 * e.g.ppc44x-defconfig has CONFIG_PTE_64BIT=y and CONFIG_32BIT=y,
3201 * so READ_ONCE or ACCESS_ONCE cannot guarantee atomic accesses.
3202 * The code below just needs a consistent view for the ifs and
3203 * we later double check anyway with the ptl lock held. So here
3204 * a barrier will do.
3205 */
3206 entry = *pte;
3207 barrier();
3199 if (!pte_present(entry)) { 3208 if (!pte_present(entry)) {
3200 if (pte_none(entry)) { 3209 if (pte_none(entry)) {
3201 if (vma->vm_ops) { 3210 if (vma->vm_ops) {
diff --git a/mm/rmap.c b/mm/rmap.c
index 45ba250babd8..c5bc241127b2 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -583,7 +583,8 @@ pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address)
583 * without holding anon_vma lock for write. So when looking for a 583 * without holding anon_vma lock for write. So when looking for a
584 * genuine pmde (in which to find pte), test present and !THP together. 584 * genuine pmde (in which to find pte), test present and !THP together.
585 */ 585 */
586 pmde = ACCESS_ONCE(*pmd); 586 pmde = *pmd;
587 barrier();
587 if (!pmd_present(pmde) || pmd_trans_huge(pmde)) 588 if (!pmd_present(pmde) || pmd_trans_huge(pmde))
588 pmd = NULL; 589 pmd = NULL;
589out: 590out: