]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - kernel/exit.c
Merge branch 'master' of git://1984.lsi.us.es/nf
[karo-tx-linux.git] / kernel / exit.c
index 34867cc5b42a77f325c204bb2fd09e1fabe38955..2f59cc334516a9b9e831bb54aa0375c999ae69b2 100644 (file)
@@ -72,6 +72,18 @@ static void __unhash_process(struct task_struct *p, bool group_dead)
                list_del_rcu(&p->tasks);
                list_del_init(&p->sibling);
                __this_cpu_dec(process_counts);
+               /*
+                * If we are the last child process in a pid namespace to be
+                * reaped, notify the reaper sleeping zap_pid_ns_processes().
+                */
+               if (IS_ENABLED(CONFIG_PID_NS)) {
+                       struct task_struct *parent = p->real_parent;
+
+                       if ((task_active_pid_ns(parent)->child_reaper == parent) &&
+                           list_empty(&parent->children) &&
+                           (parent->flags & PF_EXITING))
+                               wake_up_process(parent);
+               }
        }
        list_del_rcu(&p->thread_group);
 }
@@ -643,6 +655,7 @@ static void exit_mm(struct task_struct * tsk)
        mm_release(tsk, mm);
        if (!mm)
                return;
+       sync_mm_rss(mm);
        /*
         * Serialize with any possible pending coredump.
         * We must hold mmap_sem around checking core_state
@@ -719,12 +732,6 @@ static struct task_struct *find_new_reaper(struct task_struct *father)
 
                zap_pid_ns_processes(pid_ns);
                write_lock_irq(&tasklist_lock);
-               /*
-                * We can not clear ->child_reaper or leave it alone.
-                * There may by stealth EXIT_DEAD tasks on ->children,
-                * forget_original_parent() must move them somewhere.
-                */
-               pid_ns->child_reaper = init_pid_ns.child_reaper;
        } else if (father->signal->has_child_subreaper) {
                struct task_struct *reaper;