public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Esben Nielsen <nielsen.esben@gogglemail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	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: Re: [PATCH] cleanup and remove some extra spinlocks from rtmutex
Date: Tue, 15 Aug 2006 15:03:53 +0400	[thread overview]
Message-ID: <20060815110353.GA111@oleg> (raw)
In-Reply-To: <Pine.LNX.4.64.0608142217400.10597@frodo.shire>

On 08/14, Esben Nielsen wrote:
> 
> Well, we are talking about small optimizations now, moving only a few 
> instructions outside the lock. Except for one of them it is correct, but 
> it is worth risking stability for now?

Yes, optimization is small, but I think this cleanups the code, which is (imho)
more important. That said, I don't suggest this patch, it was a question. I stiil
can't find a time to read the code hard and convince myself I can understand it :)

Also, I think such a change opens the possibility for further cleanups.

> >--- 2.6.18-rc3/kernel/rtmutex.c~2_rtm	2006-08-13 19:07:45.000000000 +0400
> >+++ 2.6.18-rc3/kernel/rtmutex.c	2006-08-13 22:09:45.000000000 +0400
> >@@ -236,6 +236,10 @@ static int rt_mutex_adjust_prio_chain(st
> >		goto out_unlock_pi;
> >	}
> >
> >+	/* Release the task */
> >+	spin_unlock_irqrestore(&task->pi_lock, flags);
> >+	put_task_struct(task);
> >+
> 
> So you want the task to go away here and use it below?

task->pi_blocked_on != NULL, we hold task->pi_blocked_on->lock->wait_lock.
Can it go away ?

> 
> >	top_waiter = rt_mutex_top_waiter(lock);
> >
> >	/* Requeue the waiter */
> >@@ -243,10 +247,6 @@ static int rt_mutex_adjust_prio_chain(st
> >	waiter->list_entry.prio = task->prio;
> >	plist_add(&waiter->list_entry, &lock->wait_list);
> >
> >-	/* Release the task */
> >-	spin_unlock_irqrestore(&task->pi_lock, flags);
> >-	put_task_struct(task);
> >-
> 
> No! It is used in the line just above, so we better be sure it still 
> exists!

See above. If I am wrong, we can move this line

	waiter->list_entry.prio = task->prio;

up, under ->pi_lock. plist_del() doesn't need a valid ->prio.

Thanks for your answer!

Oleg.


  reply	other threads:[~2006-08-15  6:40 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 ` [PATCH] rtmutex-clean-up-and-remove-some-extra-spinlocks-more Oleg Nesterov
2006-08-13 19:03 ` [PATCH] cleanup and remove some extra spinlocks from rtmutex Oleg Nesterov
2006-08-14 20:29   ` Esben Nielsen
2006-08-15 11:03     ` Oleg Nesterov [this message]
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=20060815110353.GA111@oleg \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nielsen.esben@gogglemail.com \
    --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