Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 38fd525a4c61
("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 <oleg@redhat.com>
Link: https://lore.kernel.org/r/20240205174347.GA31461@redhat.com
Reviewed-by: Tycho Andersen <tandersen@netflix.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Oleg Nesterov and committed by
Christian Brauner
e2e8a142 9ed52108

-26
-2
include/linux/sched/signal.h
··· 735 735 #define delay_group_leader(p) \ 736 736 (thread_group_leader(p) && !thread_group_empty(p)) 737 737 738 - extern bool thread_group_exited(struct pid *pid); 739 - 740 738 extern struct sighand_struct *__lock_task_sighand(struct task_struct *task, 741 739 unsigned long *flags); 742 740
-24
kernel/exit.c
··· 1900 1900 } 1901 1901 #endif 1902 1902 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 - 1927 1903 /* 1928 1904 * This needs to be __function_aligned as GCC implicitly makes any 1929 1905 * implementation of abort() cold and drops alignment specified by