Skip to content

Commit e550f14

Browse files
committed
kill task_detached()
Upadate the last user of task_detached(), wait_task_zombie(), to use thread_group_leader() and kill task_detached(). Signed-off-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: Tejun Heo <tj@kernel.org>
1 parent 0976a03 commit e550f14

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

‎include/linux/sched.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2318,11 +2318,6 @@ static inline int thread_group_empty(struct task_struct *p)
23182318
#define delay_group_leader(p) \
23192319
(thread_group_leader(p) && !thread_group_empty(p))
23202320

2321-
static inline int task_detached(struct task_struct *p)
2322-
{
2323-
return p->exit_signal == -1;
2324-
}
2325-
23262321
/*
23272322
* Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
23282323
* subscriptions and synchronises with wait4(). Also used in procfs. Also

‎kernel/exit.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ void release_task(struct task_struct * p)
189189
zap_leader = 0;
190190
leader = p->group_leader;
191191
if (leader != p && thread_group_empty(leader) && leader->exit_state == EXIT_ZOMBIE) {
192-
BUG_ON(task_detached(leader));
193192
/*
194193
* If we were the last child thread and the leader has
195194
* exited already, and the leader's parent ignores SIGCHLD,
@@ -1231,9 +1230,9 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
12311230
traced = ptrace_reparented(p);
12321231
/*
12331232
* It can be ptraced but not reparented, check
1234-
* !task_detached() to filter out sub-threads.
1233+
* thread_group_leader() to filter out sub-threads.
12351234
*/
1236-
if (likely(!traced) && likely(!task_detached(p))) {
1235+
if (likely(!traced) && thread_group_leader(p)) {
12371236
struct signal_struct *psig;
12381237
struct signal_struct *sig;
12391238
unsigned long maxrss;

0 commit comments

Comments
 (0)