aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/signal.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-04-30 03:52:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:33 -0400
commit1406f2d321bae5ac5ff729dcb773336d9c05ec74 (patch)
tree178f7e2d800cee7be211225952f397458707587a /kernel/signal.c
parentbfc4b0890af566940de6e7aeb4b5faf46d3c3513 (diff)
lock_task_sighand: add rcu lock/unlock
Most of the callers of lock_task_sighand() doesn't actually need rcu_lock(). lock_task_sighand() needs it only to safely play with tsk->sighand, it can take the lock itself. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.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/signal.c')
-rw-r--r--kernel/signal.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index 29aca40be33f..4a45bac2c632 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -971,13 +971,11 @@ int __fatal_signal_pending(struct task_struct *tsk)
971} 971}
972EXPORT_SYMBOL(__fatal_signal_pending); 972EXPORT_SYMBOL(__fatal_signal_pending);
973 973
974/*
975 * Must be called under rcu_read_lock() or with tasklist_lock read-held.
976 */
977struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags) 974struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags)
978{ 975{
979 struct sighand_struct *sighand; 976 struct sighand_struct *sighand;
980 977
978 rcu_read_lock();
981 for (;;) { 979 for (;;) {
982 sighand = rcu_dereference(tsk->sighand); 980 sighand = rcu_dereference(tsk->sighand);
983 if (unlikely(sighand == NULL)) 981 if (unlikely(sighand == NULL))
@@ -988,6 +986,7 @@ struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long
988 break; 986 break;
989 spin_unlock_irqrestore(&sighand->siglock, *flags); 987 spin_unlock_irqrestore(&sighand->siglock, *flags);
990 } 988 }
989 rcu_read_unlock();
991 990
992 return sighand; 991 return sighand;
993} 992}