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 <jason.low2@hp.com> Acked-by: Michal Hocko <mhocko@suse.cz> Acked-by: Davidlohr Bueso <dave@stgolabs.net> Acked-by: Rik van Riel <riel@redhat.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
9d8c47e4bb
commit
4db0c3c298
@@ -1133,7 +1133,7 @@ static int anon_vma_compatible(struct vm_area_struct *a, struct vm_area_struct *
|
||||
* by another page fault trying to merge _that_. But that's ok: if it
|
||||
* is being set up, that automatically means that it will be a singleton
|
||||
* acceptable for merging, so we can do all of this optimistically. But
|
||||
* we do that ACCESS_ONCE() to make sure that we never re-load the pointer.
|
||||
* we do that READ_ONCE() to make sure that we never re-load the pointer.
|
||||
*
|
||||
* IOW: that the "list_is_singular()" test on the anon_vma_chain only
|
||||
* matters for the 'stable anon_vma' case (ie the thing we want to avoid
|
||||
@@ -1147,7 +1147,7 @@ static int anon_vma_compatible(struct vm_area_struct *a, struct vm_area_struct *
|
||||
static struct anon_vma *reusable_anon_vma(struct vm_area_struct *old, struct vm_area_struct *a, struct vm_area_struct *b)
|
||||
{
|
||||
if (anon_vma_compatible(a, b)) {
|
||||
struct anon_vma *anon_vma = ACCESS_ONCE(old->anon_vma);
|
||||
struct anon_vma *anon_vma = READ_ONCE(old->anon_vma);
|
||||
|
||||
if (anon_vma && list_is_singular(&old->anon_vma_chain))
|
||||
return anon_vma;
|
||||
@@ -2100,7 +2100,7 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns
|
||||
actual_size = size;
|
||||
if (size && (vma->vm_flags & (VM_GROWSUP | VM_GROWSDOWN)))
|
||||
actual_size -= PAGE_SIZE;
|
||||
if (actual_size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur))
|
||||
if (actual_size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur))
|
||||
return -ENOMEM;
|
||||
|
||||
/* mlock limit tests */
|
||||
@@ -2108,7 +2108,7 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns
|
||||
unsigned long locked;
|
||||
unsigned long limit;
|
||||
locked = mm->locked_vm + grow;
|
||||
limit = ACCESS_ONCE(rlim[RLIMIT_MEMLOCK].rlim_cur);
|
||||
limit = READ_ONCE(rlim[RLIMIT_MEMLOCK].rlim_cur);
|
||||
limit >>= PAGE_SHIFT;
|
||||
if (locked > limit && !capable(CAP_IPC_LOCK))
|
||||
return -ENOMEM;
|
||||
|
Reference in New Issue
Block a user