mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sripathi Kodi <sripathik@in.ibm.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Oleg Nesterov <oleg@tv-sign.ru>,
	Roland McGrath <roland@redhat.com>
Subject: [PREEMPT_RT] [PATCH 2/2] Use write_trylock_irqsave in ptrace_attach
Date: Thu, 10 May 2007 12:07:53 +0530	[thread overview]
Message-ID: <200705101207.53330.sripathik@in.ibm.com> (raw)

Hi Ingo,

This patch makes ptrace_attach() use the new API write_trylock_irqsave(). With 
this, the code in ptrace_attach() will be same for mainline and -rt. On -rt, 
write_trylock_irqsave() doesn't disable irqs and hence the problem is 
avoided.

Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>

Index: linux-2.6.21-rt1_patch/kernel/ptrace.c
===================================================================
--- linux-2.6.21-rt1_patch.orig/kernel/ptrace.c	2007-05-10 11:28:57.000000000 
+0530
+++ linux-2.6.21-rt1_patch/kernel/ptrace.c	2007-05-10 11:29:13.000000000 +0530
@@ -160,6 +160,7 @@
 int ptrace_attach(struct task_struct *task)
 {
 	int retval;
+	unsigned long flags;
 
 	retval = -EPERM;
 	if (task->pid <= 1)
@@ -178,9 +179,7 @@
 	 * cpu's that may have task_lock).
 	 */
 	task_lock(task);
-	local_irq_disable();
-	if (!write_trylock(&tasklist_lock)) {
-		local_irq_enable();
+	if (!write_trylock_irqsave(&tasklist_lock, flags)) {
 		task_unlock(task);
 		do {
 			cpu_relax();
@@ -208,7 +207,7 @@
 	force_sig_specific(SIGSTOP, task);
 
 bad:
-	write_unlock_irq(&tasklist_lock);
+	write_unlock_irqrestore(&tasklist_lock, flags);
 	task_unlock(task);
 out:
 	return retval;


                 reply	other threads:[~2007-05-10  6:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200705101207.53330.sripathik@in.ibm.com \
    --to=sripathik@in.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=roland@redhat.com \
    /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

all inboxes | Powered by JetHome®