aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-02-05 01:27:24 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 12:44:07 -0500
commitf558b7e408026eb3c6afcd0e8fc1f7fe31195a6a (patch)
tree3473617a87d54b4388c2336303075b1a54e30552 /kernel
parent198466b41d11dd062fb26ee0376080458d7bfcaf (diff)
remove handle_group_stop() in favor of do_signal_stop()
Every time we set SIGNAL_GROUP_EXIT or clear SIGNAL_STOP_DEQUEUED we also reset ->group_stop_count. This means that the SIGNAL_GROUP_EXIT check in handle_group_stop() is not needed, and do_signal_stop() should check SIGNAL_STOP_DEQUEUED only when ->group_stop_count == 0. With these changes handle_group_stop() becomes the subset of do_signal_stop(), we can kill it and use do_signal_stop() instead. Also, a preparation for the next patch. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: Davide Libenzi <davidel@xmailserver.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Robin Holt <holt@sgi.com> Cc: Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/signal.c43
1 files changed, 5 insertions, 38 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index ea90c34e9348..1117b28488c2 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1688,9 +1688,6 @@ static int do_signal_stop(int signr)
1688 struct signal_struct *sig = current->signal; 1688 struct signal_struct *sig = current->signal;
1689 int stop_count; 1689 int stop_count;
1690 1690
1691 if (!likely(sig->flags & SIGNAL_STOP_DEQUEUED))
1692 return 0;
1693
1694 if (sig->group_stop_count > 0) { 1691 if (sig->group_stop_count > 0) {
1695 /* 1692 /*
1696 * There is a group stop in progress. We don't need to 1693 * There is a group stop in progress. We don't need to
@@ -1698,12 +1695,14 @@ static int do_signal_stop(int signr)
1698 */ 1695 */
1699 stop_count = --sig->group_stop_count; 1696 stop_count = --sig->group_stop_count;
1700 } else { 1697 } else {
1698 struct task_struct *t;
1699
1700 if (!likely(sig->flags & SIGNAL_STOP_DEQUEUED))
1701 return 0;
1701 /* 1702 /*
1702 * There is no group stop already in progress. 1703 * There is no group stop already in progress.
1703 * We must initiate one now. 1704 * We must initiate one now.
1704 */ 1705 */
1705 struct task_struct *t;
1706
1707 sig->group_exit_code = signr; 1706 sig->group_exit_code = signr;
1708 1707
1709 stop_count = 0; 1708 stop_count = 0;
@@ -1731,38 +1730,6 @@ static int do_signal_stop(int signr)
1731 return 1; 1730 return 1;
1732} 1731}
1733 1732
1734/*
1735 * Do appropriate magic when group_stop_count > 0.
1736 * We return nonzero if we stopped, after releasing the siglock.
1737 * We return zero if we still hold the siglock and should look
1738 * for another signal without checking group_stop_count again.
1739 */
1740static int handle_group_stop(void)
1741{
1742 int stop_count;
1743
1744 if (current->signal->flags & SIGNAL_GROUP_EXIT)
1745 /*
1746 * Group stop is so another thread can do a core dump,
1747 * or else we are racing against a death signal.
1748 * Just punt the stop so we can get the next signal.
1749 */
1750 return 0;
1751
1752 /*
1753 * There is a group stop in progress. We stop
1754 * without any associated signal being in our queue.
1755 */
1756 stop_count = --current->signal->group_stop_count;
1757 if (stop_count == 0)
1758 current->signal->flags = SIGNAL_STOP_STOPPED;
1759 current->exit_code = current->signal->group_exit_code;
1760 set_current_state(TASK_STOPPED);
1761 spin_unlock_irq(&current->sighand->siglock);
1762 finish_stop(stop_count);
1763 return 1;
1764}
1765
1766int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, 1733int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka,
1767 struct pt_regs *regs, void *cookie) 1734 struct pt_regs *regs, void *cookie)
1768{ 1735{
@@ -1777,7 +1744,7 @@ relock:
1777 struct k_sigaction *ka; 1744 struct k_sigaction *ka;
1778 1745
1779 if (unlikely(current->signal->group_stop_count > 0) && 1746 if (unlikely(current->signal->group_stop_count > 0) &&
1780 handle_group_stop()) 1747 do_signal_stop(0))
1781 goto relock; 1748 goto relock;
1782 1749
1783 signr = dequeue_signal(current, mask, info); 1750 signr = dequeue_signal(current, mask, info);