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>
This commit is contained in:
parent
bfc4b0890a
commit
1406f2d321
1 changed files with 2 additions and 3 deletions
|
@ -971,13 +971,11 @@ int __fatal_signal_pending(struct task_struct *tsk)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__fatal_signal_pending);
|
EXPORT_SYMBOL(__fatal_signal_pending);
|
||||||
|
|
||||||
/*
|
|
||||||
* Must be called under rcu_read_lock() or with tasklist_lock read-held.
|
|
||||||
*/
|
|
||||||
struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags)
|
struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags)
|
||||||
{
|
{
|
||||||
struct sighand_struct *sighand;
|
struct sighand_struct *sighand;
|
||||||
|
|
||||||
|
rcu_read_lock();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
sighand = rcu_dereference(tsk->sighand);
|
sighand = rcu_dereference(tsk->sighand);
|
||||||
if (unlikely(sighand == NULL))
|
if (unlikely(sighand == NULL))
|
||||||
|
@ -988,6 +986,7 @@ struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long
|
||||||
break;
|
break;
|
||||||
spin_unlock_irqrestore(&sighand->siglock, *flags);
|
spin_unlock_irqrestore(&sighand->siglock, *flags);
|
||||||
}
|
}
|
||||||
|
rcu_read_unlock();
|
||||||
|
|
||||||
return sighand;
|
return sighand;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue