Skip to contentSkip to conversation

exit-kill-unnecessary-thread_group_leader-checks-in-exit_notify-and-do_notify_parent.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Mar 28

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: exit: kill unnecessary thread_group_leader() checks in exit_notify() and do_notify_parent()
has been removed from the -mm tree. Its filename was
exit-kill-unnecessary-thread_group_leader-checks-in-exit_notify-and-do_notify_parent.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Oleg Nesterov <[email protected]>
Subject: exit: kill unnecessary thread_group_leader() checks in exit_notify() and do_notify_parent()
Date: Sun, 22 Feb 2026 16:23:37 +0100

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.

Cc; Deepanshu Kartikey <[email protected]>

---

 kernel/exit.c   |    8 +++-----
 kernel/signal.c |    3 +--
 2 files changed, 4 insertions(+), 7 deletions(-)
kernel/exit.c renamed from kernel/exit.c~exit-kill-unnecessary-thread_group_leader-checks-in-exit_notify-and-do_notify_parent +3 -5
@@ -748,14 +748,12 @@ static void exit_notify(struct task_stru
 	tsk->exit_state = EXIT_ZOMBIE;
 
 	if (unlikely(tsk->ptrace)) {
-		int sig = thread_group_leader(tsk) &&
-				thread_group_empty(tsk) &&
-				!ptrace_reparented(tsk) ?
-			tsk->exit_signal : SIGCHLD;
+		int sig = thread_group_empty(tsk) && !ptrace_reparented(tsk)
+			  ? tsk->exit_signal : SIGCHLD;
 		autoreap = do_notify_parent(tsk, sig);
 	} else if (thread_group_leader(tsk)) {
 		autoreap = thread_group_empty(tsk) &&
-			do_notify_parent(tsk, tsk->exit_signal);
+			   do_notify_parent(tsk, tsk->exit_signal);
 	} else {
 		autoreap = true;
 		/* untraced sub-thread */
kernel/signal.c renamed from kernel/signal.c~exit-kill-unnecessary-thread_group_leader-checks-in-exit_notify-and-do_notify_parent +1 -2
@@ -2178,8 +2178,7 @@ bool do_notify_parent(struct task_struct
 	/* do_notify_parent_cldstop should have been called instead.  */
 	WARN_ON_ONCE(task_is_stopped_or_traced(tsk));
 
-	WARN_ON_ONCE(!tsk->ptrace &&
-	       (tsk->group_leader != tsk || !thread_group_empty(tsk)));
+	WARN_ON_ONCE(!tsk->ptrace && !thread_group_empty(tsk));
 
 	/* ptraced, or group-leader without sub-threads */
 	do_notify_pidfd(tsk);

_

Patches currently in -mm which might be from [email protected] are

kernel-fork-validate-exit_signal-in-kernel_clone-fix.patch