Skip to contentSkip to conversation

additional -rt RCU usage fixes

PATCH Applied Paul E. McKenney 2 participants 3 messages Nov 1, 2005 – Nov 2, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 additional -rt RCU usage fixes

Hello!

I guess I need to be more careful when creating experimental RCU patches, as people have been copying my mistakes. Here is a patch to fix some of them in -rt.

Signed-off-by <[email protected]>

---

 signal.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
kernel/signal.c +7 -4
diff -urpNa -X dontdiff linux-2.6.14-rc5-rt2-ckhandRCUfix/kernel/signal.c linux-2.6.14-rc5-rt2-signalRCUfix/kernel/signal.c
@@ -338,7 +338,7 @@ void exit_sighand(struct task_struct *ts
 	write_lock_irq(&tasklist_lock);
 	rcu_read_lock();
 	if (tsk->sighand != NULL) {
-		struct sighand_struct *sighand = tsk->sighand;
+		struct sighand_struct *sighand = rcu_dereference(tsk->sighand);
 		spin_lock(&sighand->siglock);
 		__exit_sighand(tsk);
 		spin_unlock(&sighand->siglock);
@@ -353,13 +353,14 @@ void exit_sighand(struct task_struct *ts
 void __exit_signal(struct task_struct *tsk)
 {
 	struct signal_struct * sig = tsk->signal;
-	struct sighand_struct * sighand = tsk->sighand;
+	struct sighand_struct * sighand;
 
 	if (!sig)
 		BUG();
 	if (!atomic_read(&sig->count))
 		BUG();
 	rcu_read_lock();
+	sighand = rcu_dereference(tsk->sighand);
 	spin_lock(&sighand->siglock);
 	posix_cpu_timers_exit(tsk);
 	if (atomic_dec_and_test(&sig->count)) {
@@ -1140,7 +1141,7 @@ void zap_other_threads(struct task_struc
 }
 
 /*
- * Must be called with the tasklist_lock held for reading!
+ * Must be called under rcu_read_lock() or with tasklist_lock read-held.
  */
 int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
 {
@@ -1422,7 +1423,7 @@ send_sigqueue(int sig, struct sigqueue *
 {
 	unsigned long flags;
 	int ret = 0;
-	struct sighand_struct *sh = p->sighand;
+	struct sighand_struct *sh;
 
 	BUG_ON(!(q->flags & SIGQUEUE_PREALLOC));
 
@@ -1442,6 +1443,8 @@ send_sigqueue(int sig, struct sigqueue *
 		goto out_err;
 	}
 
+	sh = rcu_dereference(p->sighand);
+
 	spin_lock_irqsave(&sh->siglock, flags);
 
 	/*
Applied
#1 lore raw
Quoted 5 lines · Paul E. McKenney

Hello!

I guess I need to be more careful when creating experimental RCU patches, as people have been copying my mistakes. Here is a patch to fix some of them in -rt.

thanks, applied - will show up in -rt3. Should be done for -mm too, which now includes rcu-signal-handling.patch?

Ingo

#2 lore raw
Quoted 11 lines · Ingo Molnar
Quoted 5 lines · Paul E. McKenney

Hello!

I guess I need to be more careful when creating experimental RCU patches, as people have been copying my mistakes. Here is a patch to fix some of them in -rt.

thanks, applied - will show up in -rt3. Should be done for -mm too, which now includes rcu-signal-handling.patch?

I believe it should. I will submit any needed catch-up patches against 2.6.14-mm1 when it appears.

Thanx, Paul