From: Gregory Haskins <ghaskins@novell.com>
To: mingo@elte.hu, tglx@linutronix.de, rostedt@goodmis.org,
linux-rt-users@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, sdietrich@novell.com,
pmorreale@novell.com, mkohari@novell.com, ghaskins@novell.com
Subject: [PATCH 4/5] adjust pi_lock usage in wakeup
Date: Tue, 20 May 2008 10:49:31 -0400 [thread overview]
Message-ID: <20080520144931.15992.96875.stgit@novell1.haskins.net> (raw)
In-Reply-To: <20080520143954.15992.85900.stgit@novell1.haskins.net>
From: Peter W.Morreale <pmorreale@novell.com>
In wakeup_next_waiter(), we take the pi_lock, and then find out whether
we have another waiter to add to the pending owner. We can reduce
contention on the pi_lock for the pending owner if we first obtain the
pointer to the next waiter outside of the pi_lock.
Signed-off-by: Peter W. Morreale <pmorreale@novell.com>
Signed-off-by: Gregory Haskins <ghaskins@novell.com>
---
kernel/rtmutex.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index b6ff1eb..ec1f7d4 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -506,6 +506,7 @@ static void wakeup_next_waiter(struct rt_mutex *lock, int savestate)
{
struct rt_mutex_waiter *waiter;
struct task_struct *pendowner;
+ struct rt_mutex_waiter *next;
spin_lock(¤t->pi_lock);
@@ -568,6 +569,12 @@ static void wakeup_next_waiter(struct rt_mutex *lock, int savestate)
* waiter with higher priority than pending-owner->normal_prio
* is blocked on the unboosted (pending) owner.
*/
+
+ if (rt_mutex_has_waiters(lock))
+ next = rt_mutex_top_waiter(lock);
+ else
+ next = NULL;
+
spin_lock(&pendowner->pi_lock);
WARN_ON(!pendowner->pi_blocked_on);
@@ -576,12 +583,9 @@ static void wakeup_next_waiter(struct rt_mutex *lock, int savestate)
pendowner->pi_blocked_on = NULL;
- if (rt_mutex_has_waiters(lock)) {
- struct rt_mutex_waiter *next;
-
- next = rt_mutex_top_waiter(lock);
+ if (next)
plist_add(&next->pi_list_entry, &pendowner->pi_waiters);
- }
+
spin_unlock(&pendowner->pi_lock);
}
next prev parent reply other threads:[~2008-05-20 15:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-20 14:49 [PATCH 0/5] RT: adaptive-lock enhancements Gregory Haskins
2008-05-20 14:49 ` [PATCH 1/5] optimize rt lock wakeup Gregory Haskins
2008-05-20 14:49 ` [PATCH 2/5] sched: make task->oncpu available in all configurations Gregory Haskins
2008-05-20 14:49 ` [PATCH 3/5] rtmutex: use task->oncpu to save a call Gregory Haskins
2008-05-20 14:49 ` Gregory Haskins [this message]
2008-05-20 14:49 ` [PATCH 5/5] remove the extra call to try_to_take_lock Gregory Haskins
2008-05-24 3:02 ` Steven Rostedt
2008-05-24 3:30 ` Gregory Haskins
2008-05-24 14:11 ` Peter W. Morreale
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=20080520144931.15992.96875.stgit@novell1.haskins.net \
--to=ghaskins@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mkohari@novell.com \
--cc=pmorreale@novell.com \
--cc=rostedt@goodmis.org \
--cc=sdietrich@novell.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
all inboxes | Powered by JetHome®