public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: mingo@elte.hu
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org, oleg@tv-sign.ru
Subject: [PATCH] Fix SIGSTOP locking issue in -rt
Date: Tue, 1 Nov 2005 11:58:58 -0800	[thread overview]
Message-ID: <20051101195857.GA7098@us.ibm.com> (raw)

Hello!

The following patch fixes a locking issue in -rt signals, where the
job-control signals drop sighand_lock momentarily during signal handling.
This interacts badly with the RCU-ification of unicast signal delivery.
The fix is simply to acquire tasklist_lock for job-control signals, since
these typically do not have stringent scalability or latency requirements.

These same changes would be useful in recent -mm.

Signed-off-by: <paulmck@us.ibm.com>

---

 signal.c |    8 ++++++++
 1 files changed, 8 insertions(+)

diff -urpNa -X dontdiff linux-2.6.14-rc5-rt2-ckhandRCUfix/kernel/signal.c linux-2.6.14-rc5-rt2-SIGSTOP/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-SIGSTOP/kernel/signal.c	2005-11-01 09:32:29.000000000 -0800
@@ -1207,13 +1207,21 @@ int
 kill_proc_info(int sig, struct siginfo *info, pid_t pid)
 {
 	int error;
+	int acquired_tasklist_lock = 0;
 	struct task_struct *p;
 
 	rcu_read_lock();
+	if (unlikely(sig_kernel_stop(sig) || sig == SIGCONT)) {
+		read_lock(&tasklist_lock);
+		acquired_tasklist_lock = 1;
+	}
 	p = find_task_by_pid(pid);
 	error = -ESRCH;
 	if (p)
 		error = group_send_sig_info(sig, info, p);
+	if (unlikely(acquired_tasklist_lock)) {
+		read_unlock(&tasklist_lock);
+	}
 	rcu_read_unlock();
 	return error;
 }

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-01 19:58 Paul E. McKenney [this message]
2005-11-02 13:11 ` [PATCH] Fix SIGSTOP locking issue in -rt Ingo Molnar

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=20051101195857.GA7098@us.ibm.com \
    --to=paulmck@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    /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