From: Oleg Nesterov <oleg@tv-sign.ru>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
Esben Nielsen <nielsen.esben@googlemail.com>,
linux-kernel@vger.kernel.org
Subject: Re: rt_mutex_timed_lock() vs hrtimer_wakeup() race ?
Date: Tue, 1 Aug 2006 04:12:58 +0400 [thread overview]
Message-ID: <20060801001258.GA130@oleg> (raw)
In-Reply-To: <1154298218.10074.33.camel@localhost.localdomain>
On 07/30, Steven Rostedt wrote:
>
> On Sun, 2006-07-30 at 08:36 +0400, Oleg Nesterov wrote:
> >
> > Another question, task_blocks_on_rt_mutex() does get_task_struct() and checks
> > owner->pi_blocked_on != NULL under owner->pi_lock. Why ? RT_MUTEX_HAS_WAITERS
> > bit is set, we are holding ->wait_lock, so the 'owner' can't go away until
> > we drop ->wait_lock.
>
> That's probably true that the owner can't disappear before we let go of
> the wait_lock, since the owner should not be disappearing while holding
> locks. But you are missing the point to why we are grabbing the
> pi_lock. We are preventing a race that can have us do unneeded work
> (see below).
Yes, I see. But ...
> ===================================================================
> --- linux-2.6.18-rc2.orig/kernel/rtmutex.c 2006-07-30 18:04:12.000000000 -0400
> +++ linux-2.6.18-rc2/kernel/rtmutex.c 2006-07-30 18:07:08.000000000 -0400
> @@ -433,25 +433,26 @@ static int task_blocks_on_rt_mutex(struc
> ...
> else if (debug_rt_mutex_detect_deadlock(waiter, detect_deadlock)) {
> spin_lock_irqsave(&owner->pi_lock, flags);
> - if (owner->pi_blocked_on) {
> + if (owner->pi_blocked_on)
> boost = 1;
> - /* gets dropped in rt_mutex_adjust_prio_chain()! */
> - get_task_struct(owner);
> - }
> spin_unlock_irqrestore(&owner->pi_lock, flags);
In that case ->pi_lock can't buy anything. With or without ->pi_lock this
check is equally racy, so spin_lock() only adds unneeded work?
Thanks!
Oleg.
next prev parent reply other threads:[~2006-07-31 20:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-30 4:36 rt_mutex_timed_lock() vs hrtimer_wakeup() race ? Oleg Nesterov
2006-07-30 22:23 ` Steven Rostedt
2006-08-01 0:12 ` Oleg Nesterov [this message]
2006-07-31 20:47 ` Steven Rostedt
2006-08-01 7:58 ` Thomas Gleixner
2006-08-01 12:07 ` Steven Rostedt
2006-08-01 12:52 ` Thomas Gleixner
2006-08-01 13:21 ` Steven Rostedt
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=20060801001258.GA130@oleg \
--to=oleg@tv-sign.ru \
--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