From: Steven Rostedt <rostedt@goodmis.org>
To: dwalker@mvista.com
Cc: Ingo Molnar <mingo@elte.hu>,
Karsten Wiese <annabellesgarden@yahoo.de>,
george anzinger <george@mvista.com>, Adrian Bunk <bunk@stusta.de>,
Sven-Thorsten Dietrich <sven@mvista.com>,
LKML <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [RFC] RT-patch update to remove the global pi_lock
Date: Mon, 22 Aug 2005 21:32:05 -0400 [thread overview]
Message-ID: <1124760725.5350.47.camel@localhost.localdomain> (raw)
In-Reply-To: <1124758291.9158.17.camel@dhcp153.mvista.com>
On Mon, 2005-08-22 at 17:51 -0700, Daniel Walker wrote:
> On Mon, 2005-08-22 at 20:26 -0400, Steven Rostedt wrote:
>
> >
> > How would you add to a lock with just holding a lock for a task? When
> > you are grabbing a lock, you must first grab a raw lock associated to
> > the lock being grabbed. Although, I'm starting to look into this idea,
> > and I'm going to first see if the current wait_lock could suffice. I
> > may also need to add an additional lock to the task to follow the lock
> > -> task -> lock route. The tasks order should be the same as the locks
> > when the are bound (holding) a lock. Since the task won't be able to
> > release it without holding the raw lock of the lock it is releasing.
> > (boy this gets confusing to talk about, since you need to talk about
> > locks and the locking method within the lock!)
>
> You might need to explain that one more time . I'm sure it needs more
> though, but the pi_lock just protects another cpu from enter
> pi_setprio() . What we really want is to protect only the specific
> structures modified inside pi_setprio() . Or that's my understanding .
> Are you thinking of something else?
Nope, nothing else. That's pretty much it.
>
> I think you would at least need to lock the wait_lock for each lock that
> is looped over inside pi_setprio() . Because you access the wait_list
> inside the loop .
That's what I was thinking. The wait_list locks could be the lock that
is used to replace the pi_lock.
>
> There is also a pi_waiters list that is per task. You would need to make
> a lock for that, I think . Or protect it somehow .
>
Yeah this is sort of what I was thinking of when I follow the
lock->task->lock route.
Here's a visual:
X=> : blocked on
-> : owned by
P1 X=> L1 -+
^ |
P2 X===+ |
|
+->P4 X=> L3 -> P5
|
P3 X=> L2 -+
So P4 owns locks L1 and L2 with tasks P1 and P2 blocked on L1 and P3
blocked on L2. And P4 is blocked on lock L3 owned by P5.
This has the following lists:
L1->wait_list => P1 => P2
L2->wait_list => P3
L3->wait_list => P4
P4->pi_waiters => P1 => P2 => P3
P5->pi_waiters => P4
OK, we add another lock to the task that protects the pi_waiters.
Always grab this lock _after_ grabbing all the necessary wait_locks.
So when P5 needs to update it's pi_waiters, it first grabs the
L3->wait_lock, and then the P5->pi_lock.
So when blocking on a lock, you would grab the lock->wait_locks of all
the locks that you are blocked on. When P2 blocked on a L1 it would
have grabbed (in this order) L1->wait_lock, L3->wait_lock, P4->pi_lock.
Actually, for simplicity, since the pi_lock is associated to the task,
we may be able to safely grab the task pi_lock before a wait_lock. Say
if we have P5 blocked on L4 owned by P6. When updating the
P4->pi_waiters (say when P2 blocked on L1), we could do this:
Grab L1->wait_lock, L3->wait_lock, P4->pi_lock, L4->wait_lock. Since we
should never be grabbing the L4->wait_lock (or higher) when grabbing the
P4->pi_lock.
God, I think a thesis can be made out of this. Well, let me start
coding, since I'm one of those that write code better than I design.
I'm a Spiral type of guy, not a Waterfall one ;-)
Code crap, write about it, recode it as gold!
-- Steve
next prev parent reply other threads:[~2005-08-23 1:32 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-16 12:18 2.6.13-rc6-rt3 Ingo Molnar
2005-08-16 15:31 ` 2.6.13-rc6-rt5 Steven Rostedt
2005-08-16 15:44 ` 2.6.13-rc6-rt5 Steven Rostedt
2005-08-16 16:08 ` 2.6.13-rc6-rt5 Steven Rostedt
2005-08-16 16:16 ` 2.6.13-rc6-rt5 Ingo Molnar
2005-08-16 16:22 ` 2.6.13-rc6-rt5 Ingo Molnar
2005-08-16 16:32 ` 2.6.13-rc6-rt5 Ingo Molnar
2005-08-16 16:37 ` 2.6.13-rc6-rt5 Ingo Molnar
2005-08-16 16:52 ` 2.6.13-rc6-rt5 Ingo Molnar
2005-08-16 17:08 ` 2.6.13-rc6-rt6 Ingo Molnar
2005-08-16 17:50 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-16 18:07 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-16 18:50 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-17 4:20 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-17 5:46 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-17 6:47 ` 2.6.13-rc6-rt6 Ingo Molnar
2005-08-17 14:05 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-17 14:24 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-17 16:13 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-17 16:23 ` 2.6.13-rc6-rt6 Ingo Molnar
2005-08-17 17:10 ` 2.6.13-rc6-rt6 K.R. Foley
2005-08-17 18:31 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-17 19:31 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-18 0:02 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-18 2:44 ` 2.6.13-rc6-rt6 Steven Rostedt
[not found] ` <20050822075012.GB19386@elte.hu>
[not found] ` <1124704837.5208.22.camel@localhost.localdomain>
[not found] ` <20050822101632.GA28803@elte.hu>
[not found] ` <1124710309.5208.30.camel@localhost.localdomain>
[not found] ` <20050822113858.GA1160@elte.hu>
[not found] ` <1124715755.5647.4.camel@localhost.localdomain>
[not found] ` <20050822183355.GB13888@elte.hu>
2005-08-22 19:40 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-22 19:44 ` [RFC] RT-patch update to remove the global pi_lock Steven Rostedt
2005-08-22 22:19 ` Daniel Walker
2005-08-23 0:26 ` Steven Rostedt
2005-08-23 0:51 ` Daniel Walker
2005-08-23 1:32 ` Steven Rostedt [this message]
2005-08-23 3:38 ` Steven Rostedt
[not found] ` <1124908080.5604.22.camel@localhost.localdomain>
[not found] ` <1124917003.5711.8.camel@localhost.localdomain>
2005-08-24 21:05 ` Thomas Gleixner
2005-08-25 1:13 ` Steven Rostedt
2005-08-25 1:38 ` Daniel Walker
2005-08-25 1:48 ` Steven Rostedt
2005-08-25 6:31 ` Ingo Molnar
2005-08-25 6:35 ` Ingo Molnar
2005-08-25 16:15 ` Steven Rostedt
2005-08-25 19:34 ` Ingo Molnar
2005-08-25 19:46 ` Steven Rostedt
2005-08-23 5:29 ` Ingo Molnar
2005-08-25 14:47 ` Steven Rostedt
2005-08-25 15:06 ` Steven Rostedt
2005-08-25 17:47 ` Ingo Molnar
2005-08-25 20:09 ` Steven Rostedt
2005-08-25 21:32 ` Daniel Walker
2005-08-26 2:23 ` Steven Rostedt
2005-08-26 13:52 ` Steven Rostedt
2005-08-30 15:00 ` Steven Rostedt
2005-08-30 15:52 ` Steven Rostedt
2005-08-30 23:08 ` Steven Rostedt
2005-08-31 15:01 ` [FYI] 2.6.13-rt3 and a nanosleep jitter test Steven Rostedt
2005-08-31 15:12 ` Daniel Walker
2005-08-31 15:30 ` Steven Rostedt
2005-08-31 15:13 ` Daniel Walker
2005-08-31 15:19 ` Steven Rostedt
2005-08-31 15:30 ` Daniel Walker
2005-08-23 5:46 ` 2.6.13-rc6-rt6 Ingo Molnar
2005-08-19 21:22 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-19 22:47 ` 2.6.13-rc6-rt6 Paul E. McKenney
2005-08-19 23:02 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-19 23:12 ` 2.6.13-rc6-rt6 Paul E. McKenney
2005-08-19 23:20 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-19 23:44 ` 2.6.13-rc6-rt6 Paul E. McKenney
2005-08-22 7:53 ` 2.6.13-rc6-rt6 Ingo Molnar
2005-08-17 19:27 ` 2.6.13-rc6-rt6 Ingo Molnar
2005-08-17 19:39 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-17 17:32 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-17 19:34 ` 2.6.13-rc6-rt6 Steven Rostedt
2005-08-17 5:59 ` 2.6.13-rc6-rt6 Ingo Molnar
2005-08-17 20:01 ` 2.6.13-rc6-rt8 Peter Bortas
2005-08-23 6:14 ` 2.6.13-rc6-rt8 Ingo Molnar
2005-08-28 20:36 ` 2.6.13-rc6-rt8 Peter Bortas
2005-08-18 9:57 ` 2.6.13-rc6-rt3 Alistair John Strachan
2005-08-18 10:00 ` 2.6.13-rc6-rt3 Thomas Gleixner
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=1124760725.5350.47.camel@localhost.localdomain \
--to=rostedt@goodmis.org \
--cc=annabellesgarden@yahoo.de \
--cc=bunk@stusta.de \
--cc=dwalker@mvista.com \
--cc=george@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=sven@mvista.com \
--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