[PATCH] do_sigaction: don't take tasklist_lock

do_sigaction() does not need tasklist_lock anymore, we can simplify the code.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Oleg Nesterov and committed by
Linus Torvalds
88531f72 aacc9094

+3 -19
+3 -19
kernel/signal.c
··· 2301 2301 return kill_proc_info(sig, &info, pid); 2302 2302 } 2303 2303 2304 - int 2305 - do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) 2304 + int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) 2306 2305 { 2307 2306 struct k_sigaction *k; 2308 2307 sigset_t mask; ··· 2327 2328 if (act) { 2328 2329 sigdelsetmask(&act->sa.sa_mask, 2329 2330 sigmask(SIGKILL) | sigmask(SIGSTOP)); 2331 + *k = *act; 2330 2332 /* 2331 2333 * POSIX 3.3.1.3: 2332 2334 * "Setting a signal action to SIG_IGN for a signal that is ··· 2340 2340 * be discarded, whether or not it is blocked" 2341 2341 */ 2342 2342 if (act->sa.sa_handler == SIG_IGN || 2343 - (act->sa.sa_handler == SIG_DFL && 2344 - sig_kernel_ignore(sig))) { 2345 - /* 2346 - * This is a fairly rare case, so we only take the 2347 - * tasklist_lock once we're sure we'll need it. 2348 - * Now we must do this little unlock and relock 2349 - * dance to maintain the lock hierarchy. 2350 - */ 2343 + (act->sa.sa_handler == SIG_DFL && sig_kernel_ignore(sig))) { 2351 2344 struct task_struct *t = current; 2352 - spin_unlock_irq(&t->sighand->siglock); 2353 - read_lock(&tasklist_lock); 2354 - spin_lock_irq(&t->sighand->siglock); 2355 - *k = *act; 2356 2345 sigemptyset(&mask); 2357 2346 sigaddset(&mask, sig); 2358 2347 rm_from_queue_full(&mask, &t->signal->shared_pending); ··· 2350 2361 recalc_sigpending_tsk(t); 2351 2362 t = next_thread(t); 2352 2363 } while (t != current); 2353 - spin_unlock_irq(&current->sighand->siglock); 2354 - read_unlock(&tasklist_lock); 2355 - return 0; 2356 2364 } 2357 - 2358 - *k = *act; 2359 2365 } 2360 2366 2361 2367 spin_unlock_irq(&current->sighand->siglock);