aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/signal.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-04-30 03:52:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:35 -0400
commitf6b76d4fb0039e077824be85ed4ac94e96beef86 (patch)
tree70a9ccff1d0194ff3a5ab23837f5a2ad839af6ba /kernel/signal.c
parentad16a4606939ce1bedb79c87e412467be803e990 (diff)
get_signal_to_deliver: use the cached ->signal/sighand values
Cache the values of current->signal/sighand. Shrinks .text a bit and makes the code more readable. Also, remove "sigset_t *mask", it is pointless because in fact we save the constant offset. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: Roland McGrath <roland@redhat.com> Cc: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r--kernel/signal.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index b266fa46402a..f92e6298930c 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1753,8 +1753,9 @@ static int ptrace_signal(int signr, siginfo_t *info,
1753int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, 1753int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka,
1754 struct pt_regs *regs, void *cookie) 1754 struct pt_regs *regs, void *cookie)
1755{ 1755{
1756 sigset_t *mask = &current->blocked; 1756 struct sighand_struct *sighand = current->sighand;
1757 int signr = 0; 1757 struct signal_struct *signal = current->signal;
1758 int signr;
1758 1759
1759relock: 1760relock:
1760 /* 1761 /*
@@ -1765,13 +1766,13 @@ relock:
1765 */ 1766 */
1766 try_to_freeze(); 1767 try_to_freeze();
1767 1768
1768 spin_lock_irq(&current->sighand->siglock); 1769 spin_lock_irq(&sighand->siglock);
1769 1770
1770 if (unlikely(current->signal->flags & SIGNAL_CLD_MASK)) { 1771 if (unlikely(signal->flags & SIGNAL_CLD_MASK)) {
1771 int why = (current->signal->flags & SIGNAL_STOP_CONTINUED) 1772 int why = (signal->flags & SIGNAL_STOP_CONTINUED)
1772 ? CLD_CONTINUED : CLD_STOPPED; 1773 ? CLD_CONTINUED : CLD_STOPPED;
1773 current->signal->flags &= ~SIGNAL_CLD_MASK; 1774 signal->flags &= ~SIGNAL_CLD_MASK;
1774 spin_unlock_irq(&current->sighand->siglock); 1775 spin_unlock_irq(&sighand->siglock);
1775 1776
1776 read_lock(&tasklist_lock); 1777 read_lock(&tasklist_lock);
1777 do_notify_parent_cldstop(current->group_leader, why); 1778 do_notify_parent_cldstop(current->group_leader, why);
@@ -1782,12 +1783,11 @@ relock:
1782 for (;;) { 1783 for (;;) {
1783 struct k_sigaction *ka; 1784 struct k_sigaction *ka;
1784 1785
1785 if (unlikely(current->signal->group_stop_count > 0) && 1786 if (unlikely(signal->group_stop_count > 0) &&
1786 do_signal_stop(0)) 1787 do_signal_stop(0))
1787 goto relock; 1788 goto relock;
1788 1789
1789 signr = dequeue_signal(current, mask, info); 1790 signr = dequeue_signal(current, &current->blocked, info);
1790
1791 if (!signr) 1791 if (!signr)
1792 break; /* will return 0 */ 1792 break; /* will return 0 */
1793 1793
@@ -1797,7 +1797,7 @@ relock:
1797 continue; 1797 continue;
1798 } 1798 }
1799 1799
1800 ka = &current->sighand->action[signr-1]; 1800 ka = &sighand->action[signr-1];
1801 if (ka->sa.sa_handler == SIG_IGN) /* Do nothing. */ 1801 if (ka->sa.sa_handler == SIG_IGN) /* Do nothing. */
1802 continue; 1802 continue;
1803 if (ka->sa.sa_handler != SIG_DFL) { 1803 if (ka->sa.sa_handler != SIG_DFL) {
@@ -1834,14 +1834,14 @@ relock:
1834 * We need to check for that and bail out if necessary. 1834 * We need to check for that and bail out if necessary.
1835 */ 1835 */
1836 if (signr != SIGSTOP) { 1836 if (signr != SIGSTOP) {
1837 spin_unlock_irq(&current->sighand->siglock); 1837 spin_unlock_irq(&sighand->siglock);
1838 1838
1839 /* signals can be posted during this window */ 1839 /* signals can be posted during this window */
1840 1840
1841 if (is_current_pgrp_orphaned()) 1841 if (is_current_pgrp_orphaned())
1842 goto relock; 1842 goto relock;
1843 1843
1844 spin_lock_irq(&current->sighand->siglock); 1844 spin_lock_irq(&sighand->siglock);
1845 } 1845 }
1846 1846
1847 if (likely(do_signal_stop(signr))) { 1847 if (likely(do_signal_stop(signr))) {
@@ -1856,7 +1856,7 @@ relock:
1856 continue; 1856 continue;
1857 } 1857 }
1858 1858
1859 spin_unlock_irq(&current->sighand->siglock); 1859 spin_unlock_irq(&sighand->siglock);
1860 1860
1861 /* 1861 /*
1862 * Anything else is fatal, maybe with a core dump. 1862 * Anything else is fatal, maybe with a core dump.
@@ -1882,7 +1882,7 @@ relock:
1882 do_group_exit(signr); 1882 do_group_exit(signr);
1883 /* NOTREACHED */ 1883 /* NOTREACHED */
1884 } 1884 }
1885 spin_unlock_irq(&current->sighand->siglock); 1885 spin_unlock_irq(&sighand->siglock);
1886 return signr; 1886 return signr;
1887} 1887}
1888 1888