thread_group_empty(tsk) is only possible if tsk is a group leader, and thread_group_empty() already does the thread_group_leader() check. So it makes no sense to check "thread_group_leader() && thread_group_empty()"; thread_group_empty() alone is enough.
Unified · Split
| @@ -748,14 +748,12 @@ static void exit_notify(struct task_struct *tsk, int group_dead) · 747 unmodified lines | ||
| 748 | 748 | tsk->exit_state = EXIT_ZOMBIE; |
| 749 | 749 | |
| 750 | 750 | if (unlikely(tsk->ptrace)) { |
| 751 | − int sig = thread_group_leader(tsk) && | |
| 752 | − thread_group_empty(tsk) && | |
| 753 | − !ptrace_reparented(tsk) ? | |
| 754 | − tsk->exit_signal : SIGCHLD; | |
| 751 | + int sig = thread_group_empty(tsk) && !ptrace_reparented(tsk) | |
| 752 | + ? tsk->exit_signal : SIGCHLD; | |
| 755 | 753 | autoreap = do_notify_parent(tsk, sig); |
| 756 | 754 | } else if (thread_group_leader(tsk)) { |
| 757 | 755 | autoreap = thread_group_empty(tsk) && |
| 758 | − do_notify_parent(tsk, tsk->exit_signal); | |
| 756 | + do_notify_parent(tsk, tsk->exit_signal); | |
| 759 | 757 | } else { |
| 760 | 758 | autoreap = true; |
| 761 | 759 | /* untraced sub-thread */ |
| @@ -2178,8 +2178,7 @@ bool do_notify_parent(struct task_struct *tsk, int sig) · 2177 unmodified lines | ||
| 2178 | 2178 | /* do_notify_parent_cldstop should have been called instead. */ |
| 2179 | 2179 | WARN_ON_ONCE(task_is_stopped_or_traced(tsk)); |
| 2180 | 2180 | |
| 2181 | − WARN_ON_ONCE(!tsk->ptrace && | |
| 2182 | − (tsk->group_leader != tsk || !thread_group_empty(tsk))); | |
| 2181 | + WARN_ON_ONCE(!tsk->ptrace && !thread_group_empty(tsk)); | |
| 2183 | 2182 | |
| 2184 | 2183 | /* ptraced, or group-leader without sub-threads */ |
| 2185 | 2184 | do_notify_pidfd(tsk); |