Merge tag 'perf-core-for-mingo-5.1-20190311' of git://git.kernel.org/pub/scm/linux...
[muen/linux.git] / kernel / events / core.c
index 514b8e014a2da000be9e9501e36ea65928e17012..72d06e302e9938dcaee6dbf57324d3ed31397035 100644 (file)
@@ -5474,7 +5474,7 @@ static void perf_mmap_close(struct vm_area_struct *vma)
 
                /* now it's safe to free the pages */
                atomic_long_sub(rb->aux_nr_pages, &mmap_user->locked_vm);
-               vma->vm_mm->pinned_vm -= rb->aux_mmap_locked;
+               atomic64_sub(rb->aux_mmap_locked, &vma->vm_mm->pinned_vm);
 
                /* this has to be the last one */
                rb_free_aux(rb);
@@ -5547,7 +5547,7 @@ again:
         */
 
        atomic_long_sub((size >> PAGE_SHIFT) + 1, &mmap_user->locked_vm);
-       vma->vm_mm->pinned_vm -= mmap_locked;
+       atomic64_sub(mmap_locked, &vma->vm_mm->pinned_vm);
        free_uid(mmap_user);
 
 out_put:
@@ -5695,7 +5695,7 @@ accounting:
 
        lock_limit = rlimit(RLIMIT_MEMLOCK);
        lock_limit >>= PAGE_SHIFT;
-       locked = vma->vm_mm->pinned_vm + extra;
+       locked = atomic64_read(&vma->vm_mm->pinned_vm) + extra;
 
        if ((locked > lock_limit) && perf_paranoid_tracepoint_raw() &&
                !capable(CAP_IPC_LOCK)) {
@@ -5736,7 +5736,7 @@ accounting:
 unlock:
        if (!ret) {
                atomic_long_add(user_extra, &user->locked_vm);
-               vma->vm_mm->pinned_vm += extra;
+               atomic64_add(extra, &vma->vm_mm->pinned_vm);
 
                atomic_inc(&event->mmap_count);
        } else if (rb) {