diff options
Diffstat (limited to 'kernel/exit.c')
| -rw-r--r-- | kernel/exit.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 34867cc5b42a..2f59cc334516 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
| @@ -72,6 +72,18 @@ static void __unhash_process(struct task_struct *p, bool group_dead) | |||
| 72 | list_del_rcu(&p->tasks); | 72 | list_del_rcu(&p->tasks); |
| 73 | list_del_init(&p->sibling); | 73 | list_del_init(&p->sibling); |
| 74 | __this_cpu_dec(process_counts); | 74 | __this_cpu_dec(process_counts); |
| 75 | /* | ||
| 76 | * If we are the last child process in a pid namespace to be | ||
| 77 | * reaped, notify the reaper sleeping zap_pid_ns_processes(). | ||
| 78 | */ | ||
| 79 | if (IS_ENABLED(CONFIG_PID_NS)) { | ||
| 80 | struct task_struct *parent = p->real_parent; | ||
| 81 | |||
| 82 | if ((task_active_pid_ns(parent)->child_reaper == parent) && | ||
| 83 | list_empty(&parent->children) && | ||
| 84 | (parent->flags & PF_EXITING)) | ||
| 85 | wake_up_process(parent); | ||
| 86 | } | ||
| 75 | } | 87 | } |
| 76 | list_del_rcu(&p->thread_group); | 88 | list_del_rcu(&p->thread_group); |
| 77 | } | 89 | } |
| @@ -643,6 +655,7 @@ static void exit_mm(struct task_struct * tsk) | |||
| 643 | mm_release(tsk, mm); | 655 | mm_release(tsk, mm); |
| 644 | if (!mm) | 656 | if (!mm) |
| 645 | return; | 657 | return; |
| 658 | sync_mm_rss(mm); | ||
| 646 | /* | 659 | /* |
| 647 | * Serialize with any possible pending coredump. | 660 | * Serialize with any possible pending coredump. |
| 648 | * We must hold mmap_sem around checking core_state | 661 | * We must hold mmap_sem around checking core_state |
| @@ -719,12 +732,6 @@ static struct task_struct *find_new_reaper(struct task_struct *father) | |||
| 719 | 732 | ||
| 720 | zap_pid_ns_processes(pid_ns); | 733 | zap_pid_ns_processes(pid_ns); |
| 721 | write_lock_irq(&tasklist_lock); | 734 | write_lock_irq(&tasklist_lock); |
| 722 | /* | ||
| 723 | * We can not clear ->child_reaper or leave it alone. | ||
| 724 | * There may by stealth EXIT_DEAD tasks on ->children, | ||
| 725 | * forget_original_parent() must move them somewhere. | ||
| 726 | */ | ||
| 727 | pid_ns->child_reaper = init_pid_ns.child_reaper; | ||
| 728 | } else if (father->signal->has_child_subreaper) { | 735 | } else if (father->signal->has_child_subreaper) { |
| 729 | struct task_struct *reaper; | 736 | struct task_struct *reaper; |
| 730 | 737 | ||
