]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - kernel/exit.c
Merge tag 'for-linus-2020-01-03' of git://git.kernel.org/pub/scm/linux/kernel/git...
[thirdparty/linux.git] / kernel / exit.c
index fc364272759de1b75259d2a9936e47dc931438fc..2833ffb0c2110c482010954e73ed836395eaa6a6 100644 (file)
@@ -437,7 +437,7 @@ static void exit_mm(void)
        struct mm_struct *mm = current->mm;
        struct core_state *core_state;
 
-       mm_release(current, mm);
+       exit_mm_release(current, mm);
        if (!mm)
                return;
        sync_mm_rss(mm);
@@ -742,32 +742,12 @@ void __noreturn do_exit(long code)
         */
        if (unlikely(tsk->flags & PF_EXITING)) {
                pr_alert("Fixing recursive fault but reboot is needed!\n");
-               /*
-                * We can do this unlocked here. The futex code uses
-                * this flag just to verify whether the pi state
-                * cleanup has been done or not. In the worst case it
-                * loops once more. We pretend that the cleanup was
-                * done as there is no way to return. Either the
-                * OWNER_DIED bit is set by now or we push the blocked
-                * task into the wait for ever nirwana as well.
-                */
-               tsk->flags |= PF_EXITPIDONE;
+               futex_exit_recursive(tsk);
                set_current_state(TASK_UNINTERRUPTIBLE);
                schedule();
        }
 
        exit_signals(tsk);  /* sets PF_EXITING */
-       /*
-        * Ensure that all new tsk->pi_lock acquisitions must observe
-        * PF_EXITING. Serializes against futex.c:attach_to_pi_owner().
-        */
-       smp_mb();
-       /*
-        * Ensure that we must observe the pi_state in exit_mm() ->
-        * mm_release() -> exit_pi_state_list().
-        */
-       raw_spin_lock_irq(&tsk->pi_lock);
-       raw_spin_unlock_irq(&tsk->pi_lock);
 
        if (unlikely(in_atomic())) {
                pr_info("note: %s[%d] exited with preempt_count %d\n",
@@ -850,12 +830,6 @@ void __noreturn do_exit(long code)
         * Make sure we are holding no locks:
         */
        debug_check_no_locks_held();
-       /*
-        * We can do this unlocked here. The futex code uses this flag
-        * just to verify whether the pi state cleanup has been done
-        * or not. In the worst case it loops once more.
-        */
-       tsk->flags |= PF_EXITPIDONE;
 
        if (tsk->io_context)
                exit_io_context(tsk);
@@ -1439,7 +1413,7 @@ static int child_wait_callback(wait_queue_entry_t *wait, unsigned mode,
 void __wake_up_parent(struct task_struct *p, struct task_struct *parent)
 {
        __wake_up_sync_key(&parent->signal->wait_chldexit,
-                               TASK_INTERRUPTIBLE, 1, p);
+                          TASK_INTERRUPTIBLE, p);
 }
 
 static long do_wait(struct wait_opts *wo)
@@ -1461,7 +1435,7 @@ repeat:
         */
        wo->notask_error = -ECHILD;
        if ((wo->wo_type < PIDTYPE_MAX) &&
-          (!wo->wo_pid || hlist_empty(&wo->wo_pid->tasks[wo->wo_type])))
+          (!wo->wo_pid || !pid_has_task(wo->wo_pid, wo->wo_type)))
                goto notask;
 
        set_current_state(TASK_INTERRUPTIBLE);