* [PATCH 6/6] do_sigaction: don't take tasklist_lock
@ 2006-02-22 23:05 Oleg Nesterov
0 siblings, 0 replies; only message in thread
From: Oleg Nesterov @ 2006-02-22 23:05 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Ingo Molnar, Paul E. McKenney, Eric W. Biederman,
David Howells
do_sigaction() does not need tasklist_lock anymore,
we can simplify the code.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 2.6.16-rc3/kernel/signal.c~6_DOSA 2006-02-23 01:46:17.000000000 +0300
+++ 2.6.16-rc3/kernel/signal.c 2006-02-23 02:16:08.000000000 +0300
@@ -2303,8 +2303,7 @@ sys_rt_sigqueueinfo(int pid, int sig, si
return kill_proc_info(sig, &info, pid);
}
-int
-do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
+int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
{
struct k_sigaction *k;
sigset_t mask;
@@ -2330,6 +2329,7 @@ do_sigaction(int sig, struct k_sigaction
if (act) {
sigdelsetmask(&act->sa.sa_mask,
sigmask(SIGKILL) | sigmask(SIGSTOP));
+ *k = *act;
/*
* POSIX 3.3.1.3:
* "Setting a signal action to SIG_IGN for a signal that is
@@ -2342,19 +2342,8 @@ do_sigaction(int sig, struct k_sigaction
* be discarded, whether or not it is blocked"
*/
if (act->sa.sa_handler == SIG_IGN ||
- (act->sa.sa_handler == SIG_DFL &&
- sig_kernel_ignore(sig))) {
- /*
- * This is a fairly rare case, so we only take the
- * tasklist_lock once we're sure we'll need it.
- * Now we must do this little unlock and relock
- * dance to maintain the lock hierarchy.
- */
+ (act->sa.sa_handler == SIG_DFL && sig_kernel_ignore(sig))) {
struct task_struct *t = current;
- spin_unlock_irq(&t->sighand->siglock);
- read_lock(&tasklist_lock);
- spin_lock_irq(&t->sighand->siglock);
- *k = *act;
sigemptyset(&mask);
sigaddset(&mask, sig);
rm_from_queue_full(&mask, &t->signal->shared_pending);
@@ -2363,12 +2352,7 @@ do_sigaction(int sig, struct k_sigaction
recalc_sigpending_tsk(t);
t = next_thread(t);
} while (t != current);
- spin_unlock_irq(¤t->sighand->siglock);
- read_unlock(&tasklist_lock);
- return 0;
}
-
- *k = *act;
}
spin_unlock_irq(¤t->sighand->siglock);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-02-22 23:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-22 23:05 [PATCH 6/6] do_sigaction: don't take tasklist_lock Oleg Nesterov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®