diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2020-07-01 14:30:06 +0200 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2020-07-07 18:58:17 +0200 |
commit | 38fd525a4c61e7ecdc9ad4dcbf7b767d0a007962 (patch) | |
tree | 1f255a978951c7c7464626f5de640d6ad5a420ac /include | |
parent | umd: Track user space drivers with struct pid (diff) | |
download | linux-38fd525a4c61e7ecdc9ad4dcbf7b767d0a007962.tar.xz linux-38fd525a4c61e7ecdc9ad4dcbf7b767d0a007962.zip |
exit: Factor thread_group_exited out of pidfd_poll
Create an independent helper thread_group_exited which returns true
when all threads have passed exit_notify in do_exit. AKA all of the
threads are at least zombies and might be dead or completely gone.
Create this helper by taking the logic out of pidfd_poll where it is
already tested, and adding a READ_ONCE on the read of
task->exit_state.
I will be changing the user mode driver code to use this same logic
to know when a user mode driver needs to be restarted.
Place the new helper thread_group_exited in kernel/exit.c and
EXPORT it so it can be used by modules.
Link: https://lkml.kernel.org/r/20200702164140.4468-13-ebiederm@xmission.com
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Tested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/sched/signal.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h index 0ee5e696c5d8..1bad18a1d8ba 100644 --- a/include/linux/sched/signal.h +++ b/include/linux/sched/signal.h @@ -674,6 +674,8 @@ static inline int thread_group_empty(struct task_struct *p) #define delay_group_leader(p) \ (thread_group_leader(p) && !thread_group_empty(p)) +extern bool thread_group_exited(struct pid *pid); + extern struct sighand_struct *__lock_task_sighand(struct task_struct *task, unsigned long *flags); |