signal: introduce retarget_shared_pending()
No functional changes. Move the notify-other-threads code from exit_signals() to the new helper, retarget_shared_pending(). Signed-off-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: Matt Fleming <matt.fleming@linux.intel.com> Acked-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
@@ -2198,10 +2198,25 @@ relock:
|
|||||||
return signr;
|
return signr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* It could be that complete_signal() picked us to notify about the
|
||||||
|
* group-wide signal. Another thread should be notified now to take
|
||||||
|
* the signal since we will not.
|
||||||
|
*/
|
||||||
|
static void retarget_shared_pending(struct task_struct *tsk)
|
||||||
|
{
|
||||||
|
struct task_struct *t;
|
||||||
|
|
||||||
|
t = tsk;
|
||||||
|
while_each_thread(tsk, t) {
|
||||||
|
if (!signal_pending(t) && !(t->flags & PF_EXITING))
|
||||||
|
recalc_sigpending_and_wake(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void exit_signals(struct task_struct *tsk)
|
void exit_signals(struct task_struct *tsk)
|
||||||
{
|
{
|
||||||
int group_stop = 0;
|
int group_stop = 0;
|
||||||
struct task_struct *t;
|
|
||||||
|
|
||||||
if (thread_group_empty(tsk) || signal_group_exit(tsk->signal)) {
|
if (thread_group_empty(tsk) || signal_group_exit(tsk->signal)) {
|
||||||
tsk->flags |= PF_EXITING;
|
tsk->flags |= PF_EXITING;
|
||||||
@@ -2217,14 +2232,7 @@ void exit_signals(struct task_struct *tsk)
|
|||||||
if (!signal_pending(tsk))
|
if (!signal_pending(tsk))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/*
|
retarget_shared_pending(tsk);
|
||||||
* It could be that __group_complete_signal() choose us to
|
|
||||||
* notify about group-wide signal. Another thread should be
|
|
||||||
* woken now to take the signal since we will not.
|
|
||||||
*/
|
|
||||||
for (t = tsk; (t = next_thread(t)) != tsk; )
|
|
||||||
if (!signal_pending(t) && !(t->flags & PF_EXITING))
|
|
||||||
recalc_sigpending_and_wake(t);
|
|
||||||
|
|
||||||
if (unlikely(tsk->group_stop & GROUP_STOP_PENDING) &&
|
if (unlikely(tsk->group_stop & GROUP_STOP_PENDING) &&
|
||||||
task_participate_group_stop(tsk))
|
task_participate_group_stop(tsk))
|
||||||
|
|||||||
Reference in New Issue
Block a user