Skip to contentSkip to conversation

lock_task_sighand: add rcu lock/unlock

PATCH New Oleg Nesterov 1 participant 1 message Feb 18, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 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.

kernel/signal.c renamed from kernel/signal.c~1_LTS_RCU +2 -3
@@ -978,13 +978,11 @@ int fastcall __fatal_signal_pending(stru
 }
 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 *sighand;
 
+	rcu_read_lock();
 	for (;;) {
 		sighand = rcu_dereference(tsk->sighand);
 		if (unlikely(sighand == NULL))
@@ -995,6 +993,7 @@ struct sighand_struct *lock_task_sighand
 			break;
 		spin_unlock_irqrestore(&sighand->siglock, *flags);
 	}
+	rcu_read_unlock();
 
 	return sighand;
 }