public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@osdl.org>, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	Esben Nielsen <nielsen.esben@googlemail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] rtmutex-clean-up-and-remove-some-extra-spinlocks-more
Date: Sun, 13 Aug 2006 19:55:21 +0400	[thread overview]
Message-ID: <20060813155521.GA1311@oleg> (raw)
In-Reply-To: <1154439588.25445.31.camel@localhost.localdomain>

On top of Steven's rtmutex-clean-up-and-remove-some-extra-spinlocks.patch

There are still 2 get_task_struct()s under ->pi_lock. Imho, this is
confusing. Move them outside of ->pi_lock protected section. The task
can't go away, otherwise it was unsafe to take task->pi_lock.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- 2.6.18-rc3/kernel/rtmutex.c~	2006-08-13 18:49:28.000000000 +0400
+++ 2.6.18-rc3/kernel/rtmutex.c	2006-08-13 19:07:45.000000000 +0400
@@ -249,6 +249,7 @@ static int rt_mutex_adjust_prio_chain(st
 
 	/* Grab the next task */
 	task = rt_mutex_owner(lock);
+	get_task_struct(task);
 	spin_lock_irqsave(&task->pi_lock, flags);
 
 	if (waiter == rt_mutex_top_waiter(lock)) {
@@ -267,7 +268,6 @@ static int rt_mutex_adjust_prio_chain(st
 		__rt_mutex_adjust_prio(task);
 	}
 
-	get_task_struct(task);
 	spin_unlock_irqrestore(&task->pi_lock, flags);
 
 	top_waiter = rt_mutex_top_waiter(lock);
@@ -589,10 +589,10 @@ void rt_mutex_adjust_pi(struct task_stru
 		return;
 	}
 
-	/* gets dropped in rt_mutex_adjust_prio_chain()! */
-	get_task_struct(task);
 	spin_unlock_irqrestore(&task->pi_lock, flags);
 
+	/* gets dropped in rt_mutex_adjust_prio_chain()! */
+	get_task_struct(task);
 	rt_mutex_adjust_prio_chain(task, 0, NULL, NULL, task);
 }
 


  reply	other threads:[~2006-08-13 11:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-01 13:39 [PATCH] cleanup and remove some extra spinlocks from rtmutex Steven Rostedt
2006-08-13 15:55 ` Oleg Nesterov [this message]
2006-08-13 19:03 ` Oleg Nesterov
2006-08-14 20:29   ` Esben Nielsen
2006-08-15 11:03     ` Oleg Nesterov
2006-08-15  9:54       ` Esben Nielsen
2006-08-15 14:26         ` Oleg Nesterov
2006-08-15 10:05           ` Esben Nielsen
2006-08-15 14:46             ` Oleg Nesterov

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=20060813155521.GA1311@oleg \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nielsen.esben@googlemail.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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