public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@elte.hu
Subject: [PATCH] additional -rt RCU usage fixes
Date: Tue, 1 Nov 2005 09:01:53 -0800	[thread overview]
Message-ID: <20051101170153.GA6564@us.ibm.com> (raw)

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: <paulmck@us.ibm.com>

---

 signal.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff -urpNa -X dontdiff linux-2.6.14-rc5-rt2-ckhandRCUfix/kernel/signal.c linux-2.6.14-rc5-rt2-signalRCUfix/kernel/signal.c
--- linux-2.6.14-rc5-rt2-ckhandRCUfix/kernel/signal.c	2005-10-31 22:28:45.000000000 -0800
+++ linux-2.6.14-rc5-rt2-signalRCUfix/kernel/signal.c	2005-10-31 22:40:07.000000000 -0800
@@ -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);
 
 	/*

             reply	other threads:[~2005-11-01 17:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-01 17:01 Paul E. McKenney [this message]
2005-11-02 13:12 ` [PATCH] additional -rt RCU usage fixes Ingo Molnar
2005-11-02 16:51   ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051101170153.GA6564@us.ibm.com \
    --to=paulmck@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox