mm: remove rest of ACCESS_ONCE() usages

We converted some of the usages of ACCESS_ONCE to READ_ONCE in the mm/
tree since it doesn't work reliably on non-scalar types.

This patch removes the rest of the usages of ACCESS_ONCE, and use the new
READ_ONCE API for the read accesses.  This makes things cleaner, instead
of using separate/multiple sets of APIs.

Signed-off-by: Jason Low <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Acked-by: Davidlohr Bueso <[email protected]>
Acked-by: Rik van Riel <[email protected]>
Reviewed-by: Christian Borntraeger <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Jason Low 2015-04-15 16:14:08 -07:00 • committed by Linus Torvalds
commit 4db0c3c298
11 changed files with 33 additions and 33 deletions

View file

@ -542,7 +542,7 @@ static struct page *get_ksm_page(struct stable_node *stable_node, bool lock_it)
expected_mapping = (void *)stable_node +
(PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
again:
kpfn = ACCESS_ONCE(stable_node->kpfn);
kpfn = READ_ONCE(stable_node->kpfn);
page = pfn_to_page(kpfn);
/*
@ -551,7 +551,7 @@ again:
* but on Alpha we need to be more careful.
*/
smp_read_barrier_depends();
if (ACCESS_ONCE(page->mapping) != expected_mapping)
if (READ_ONCE(page->mapping) != expected_mapping)
goto stale;
/*
@ -577,14 +577,14 @@ again:
cpu_relax();
}
if (ACCESS_ONCE(page->mapping) != expected_mapping) {
if (READ_ONCE(page->mapping) != expected_mapping) {
put_page(page);
goto stale;
}
if (lock_it) {
lock_page(page);
if (ACCESS_ONCE(page->mapping) != expected_mapping) {
if (READ_ONCE(page->mapping) != expected_mapping) {
unlock_page(page);
put_page(page);
goto stale;
@ -600,7 +600,7 @@ stale:
* before checking whether node->kpfn has been changed.
*/
smp_rmb();
if (ACCESS_ONCE(stable_node->kpfn) != kpfn)
if (READ_ONCE(stable_node->kpfn) != kpfn)
goto again;
remove_node_from_stable_tree(stable_node);
return NULL;