mm: move MAP_SYNC to asm-generic/mman-common.h
[linux-2.6-block.git] / kernel / exit.c
index 2166c2d92ddc0c8a0af6e5a1dd833fe0243fd06a..a75b6a7f458a7287439e40f0ac102fbb8b61e4a4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/kernel/exit.c
  *
@@ -194,6 +195,7 @@ repeat:
        rcu_read_unlock();
 
        proc_flush_task(p);
+       cgroup_release(p);
 
        write_lock_irq(&tasklist_lock);
        ptrace_release_task(p);
@@ -219,7 +221,6 @@ repeat:
        }
 
        write_unlock_irq(&tasklist_lock);
-       cgroup_release(p);
        release_thread(p);
        call_rcu(&p->rcu, delayed_put_task_struct);
 
@@ -422,7 +423,7 @@ retry:
         * freed task structure.
         */
        if (atomic_read(&mm->mm_users) <= 1) {
-               mm->owner = NULL;
+               WRITE_ONCE(mm->owner, NULL);
                return;
        }
 
@@ -462,7 +463,7 @@ retry:
         * most likely racing with swapoff (try_to_unuse()) or /proc or
         * ptrace or page migration (get_task_mm()).  Mark owner as NULL.
         */
-       mm->owner = NULL;
+       WRITE_ONCE(mm->owner, NULL);
        return;
 
 assign_new_owner:
@@ -483,7 +484,7 @@ assign_new_owner:
                put_task_struct(c);
                goto retry;
        }
-       mm->owner = c;
+       WRITE_ONCE(mm->owner, c);
        task_unlock(c);
        put_task_struct(c);
 }