kernel/signal.c: simplify force_sig_info_to_task(), kill recalc_sigpending_and_wake()
[linux-2.6-block.git] / kernel / signal.c
index 5aa216e841a292dbb570b219f01869765d6d13f5..c9c57d053ce4f64d9a832f358b4e1ee837959b8b 100644 (file)
@@ -171,16 +171,6 @@ static bool recalc_sigpending_tsk(struct task_struct *t)
        return false;
 }
 
-/*
- * After recalculating TIF_SIGPENDING, we need to make sure the task wakes up.
- * This is superfluous when called on current, the wakeup is a harmless no-op.
- */
-void recalc_sigpending_and_wake(struct task_struct *t)
-{
-       if (recalc_sigpending_tsk(t))
-               signal_wake_up(t, 0);
-}
-
 void recalc_sigpending(void)
 {
        if (!recalc_sigpending_tsk(current) && !freezing(current))
@@ -1348,10 +1338,8 @@ force_sig_info_to_task(struct kernel_siginfo *info, struct task_struct *t,
                action->sa.sa_handler = SIG_DFL;
                if (handler == HANDLER_EXIT)
                        action->sa.sa_flags |= SA_IMMUTABLE;
-               if (blocked) {
+               if (blocked)
                        sigdelset(&t->blocked, sig);
-                       recalc_sigpending_and_wake(t);
-               }
        }
        /*
         * Don't clear SIGNAL_UNKILLABLE for traced tasks, users won't expect
@@ -1361,6 +1349,9 @@ force_sig_info_to_task(struct kernel_siginfo *info, struct task_struct *t,
            (!t->ptrace || (handler == HANDLER_EXIT)))
                t->signal->flags &= ~SIGNAL_UNKILLABLE;
        ret = send_signal_locked(sig, info, t, PIDTYPE_PID);
+       /* This can happen if the signal was already pending and blocked */
+       if (!task_sigpending(t))
+               signal_wake_up(t, 0);
        spin_unlock_irqrestore(&t->sighand->siglock, flags);
 
        return ret;