Skip to content

Commit e2e8a14

Browse files
oleg-nesterovbrauner
authored andcommitted
pidfd: exit: kill the no longer used thread_group_exited()
It was used by pidfd_poll() but now it has no callers. If it finally finds a modular user we can revert this change, but note that the comment above this helper and the changelog in 38fd525 ("exit: Factor thread_group_exited out of pidfd_poll") are not accurate, thread_group_exited() won't return true if all other threads have passed exit_notify() and are zombies, it returns true only when all other threads are completely gone. Not to mention that it can only work if the task identified by @pid is a thread-group leader. Signed-off-by: Oleg Nesterov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Tycho Andersen <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 9ed5210 commit e2e8a14

File tree

2 files changed

+0
-26
lines changed

2 files changed

+0
-26
lines changed

include/linux/sched/signal.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,6 @@ static inline int thread_group_empty(struct task_struct *p)
735735
#define delay_group_leader(p) \
736736
(thread_group_leader(p) && !thread_group_empty(p))
737737

738-
extern bool thread_group_exited(struct pid *pid);
739-
740738
extern struct sighand_struct *__lock_task_sighand(struct task_struct *task,
741739
unsigned long *flags);
742740

kernel/exit.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,30 +1900,6 @@ COMPAT_SYSCALL_DEFINE5(waitid,
19001900
}
19011901
#endif
19021902

1903-
/**
1904-
* thread_group_exited - check that a thread group has exited
1905-
* @pid: tgid of thread group to be checked.
1906-
*
1907-
* Test if the thread group represented by tgid has exited (all
1908-
* threads are zombies, dead or completely gone).
1909-
*
1910-
* Return: true if the thread group has exited. false otherwise.
1911-
*/
1912-
bool thread_group_exited(struct pid *pid)
1913-
{
1914-
struct task_struct *task;
1915-
bool exited;
1916-
1917-
rcu_read_lock();
1918-
task = pid_task(pid, PIDTYPE_PID);
1919-
exited = !task ||
1920-
(READ_ONCE(task->exit_state) && thread_group_empty(task));
1921-
rcu_read_unlock();
1922-
1923-
return exited;
1924-
}
1925-
EXPORT_SYMBOL(thread_group_exited);
1926-
19271903
/*
19281904
* This needs to be __function_aligned as GCC implicitly makes any
19291905
* implementation of abort() cold and drops alignment specified by

0 commit comments

Comments
 (0)