summaryrefslogtreecommitdiffstats
path: root/kernel/signal.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2011-04-27 19:17:37 +0200
committerOleg Nesterov <oleg@redhat.com>2011-04-28 13:01:35 +0200
commit0edceb7bcd82802f721f3c94eed9b3e2869d3740 (patch)
treeef24801563d721a2823d6c863d3d68f20ce39857 /kernel/signal.c
parente46bc9b6fd65bc9f406a4211fbf95683cc9c2937 (diff)
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>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r--kernel/signal.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index c15e9792b08..5341e214190 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2198,10 +2198,25 @@ relock:
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)
{
int group_stop = 0;
- struct task_struct *t;
if (thread_group_empty(tsk) || signal_group_exit(tsk->signal)) {
tsk->flags |= PF_EXITING;
@@ -2217,14 +2232,7 @@ void exit_signals(struct task_struct *tsk)
if (!signal_pending(tsk))
goto out;
- /*
- * 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);
+ retarget_shared_pending(tsk);
if (unlikely(tsk->group_stop & GROUP_STOP_PENDING) &&
task_participate_group_stop(tsk))