Commit 9d8c47e4 authored by Jason Low's avatar Jason Low Committed by Linus Torvalds

mm: use READ_ONCE() for non-scalar types

Commit 38c5ce93 ("mm/gup: Replace ACCESS_ONCE with READ_ONCE")
converted ACCESS_ONCE usage in gup_pmd_range() to READ_ONCE, since
ACCESS_ONCE doesn't work reliably on non-scalar types.

This patch also fixes the other ACCESS_ONCE usages in gup_pte_range()
and __get_user_pages_fast() in mm/gup.c
Signed-off-by: default avatarJason Low <jason.low2@hp.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
Acked-by: default avatarDavidlohr Bueso <dave@stgolabs.net>
Acked-by: default avatarRik van Riel <riel@redhat.com>
Reviewed-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6cd57613
...@@ -1019,7 +1019,7 @@ static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end, ...@@ -1019,7 +1019,7 @@ static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end,
* *
* for an example see gup_get_pte in arch/x86/mm/gup.c * for an example see gup_get_pte in arch/x86/mm/gup.c
*/ */
pte_t pte = ACCESS_ONCE(*ptep); pte_t pte = READ_ONCE(*ptep);
struct page *page; struct page *page;
/* /*
...@@ -1309,7 +1309,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, ...@@ -1309,7 +1309,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
local_irq_save(flags); local_irq_save(flags);
pgdp = pgd_offset(mm, addr); pgdp = pgd_offset(mm, addr);
do { do {
pgd_t pgd = ACCESS_ONCE(*pgdp); pgd_t pgd = READ_ONCE(*pgdp);
next = pgd_addr_end(addr, end); next = pgd_addr_end(addr, end);
if (pgd_none(pgd)) if (pgd_none(pgd))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment