From: hyl <heyongli@gmail.com>
To: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org
Cc: mingo@elte.hu
Subject: [RT] remove_waiter does not need to do chain walk?(2.6.25.4-rt)
Date: Tue, 24 Jun 2008 16:07:58 +0800 [thread overview]
Message-ID: <505766fa0806240107hacebf36q6c5b4d97278272b4@mail.gmail.com> (raw)
Hi, everyone
lets us just focus on remove_waiter in rt_spin_lock_slowlock
(2.6.25.4-rt). refer to bellowing brief code .
i notice the comments above calling the remove_waiter , but i can't
figure out the sequence which meet
the comment.
I do figure out a event sequence to proof we must call
remove_waiter , but chain walk seems is not needed.
0). current process block on this lock (note:block on lock not the process)
1). adaptive_wait continue the loop without sleeping due to event
2): owner change( held no lock while adaptive wait)
2.) owner free the lock, another process be selected as pending
owner, then release lock
2.x) then current be boosted , and become pending owner's top
waiter, so pending owner be boosted too
3. in the new round loop: do_try_to_take_rt_mutex->try_to_steal_lock
lucky own the lock,
and at this time, waiter.task is not NULL
Question is: seems pending owner's block_on is null, remove_waiter
seems need no chain walk?
My scenario may not be the one of author, please don't hesitate to
offer a example to clarity this question,
i think discuss about this make it clear and easy to maintain.
rt_spin_lock_slowlock(struct rt_mutex *lock)
{
.........
for (;;) {
if (do_try_to_take_rt_mutex(lock, STEAL_LATERAL)) {
...
if (!waiter.task) {
. ..
}
....
if (adaptive_wait(&waiter, orig_owner)) {
......
}
.....
}
....
/*
* Extremely rare case, if we got woken up by a non-mutex wakeup,
* and we managed to steal the lock despite us not being the
* highest-prio waiter (due to SCHED_OTHER changing prio), then we
* can end up with a non-NULL waiter.task:
*/
if (unlikely(waiter.task))
remove_waiter(lock, &waiter, flags);
.....
}
Regards
hyl
next reply other threads:[~2008-06-24 8:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-24 8:07 hyl [this message]
2008-06-26 13:13 ` [RT] remove_waiter does not need to do chain walk?(2.6.25.4-rt) hyl
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=505766fa0806240107hacebf36q6c5b4d97278272b4@mail.gmail.com \
--to=heyongli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=mingo@elte.hu \
/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;
as well as URLs for NNTP newsgroup(s).