Commit 26ba8e4b authored by Gregory Haskins's avatar Gregory Haskins Committed by Thomas Gleixner

rtmutex: Adjust pi_lock usage in wakeup

[ The following text is in the "utf-8" character set. ]
    [ Your display is set for the "iso-8859-1" character set.  ]
    [ Some characters may be displayed incorrectly. ]

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: default avatarPeter W. Morreale <pmorreale@novell.com>
Signed-off-by: default avatarGregory Haskins <ghaskins@novell.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 5aef092b
...@@ -507,6 +507,7 @@ static void wakeup_next_waiter(struct rt_mutex *lock, int savestate) ...@@ -507,6 +507,7 @@ static void wakeup_next_waiter(struct rt_mutex *lock, int savestate)
{ {
struct rt_mutex_waiter *waiter; struct rt_mutex_waiter *waiter;
struct task_struct *pendowner; struct task_struct *pendowner;
struct rt_mutex_waiter *next;
atomic_spin_lock(&current->pi_lock); atomic_spin_lock(&current->pi_lock);
...@@ -569,6 +570,12 @@ static void wakeup_next_waiter(struct rt_mutex *lock, int savestate) ...@@ -569,6 +570,12 @@ static void wakeup_next_waiter(struct rt_mutex *lock, int savestate)
* waiter with higher priority than pending-owner->normal_prio * waiter with higher priority than pending-owner->normal_prio
* is blocked on the unboosted (pending) owner. * is blocked on the unboosted (pending) owner.
*/ */
if (rt_mutex_has_waiters(lock))
next = rt_mutex_top_waiter(lock);
else
next = NULL;
atomic_spin_lock(&pendowner->pi_lock); atomic_spin_lock(&pendowner->pi_lock);
WARN_ON(!pendowner->pi_blocked_on); WARN_ON(!pendowner->pi_blocked_on);
...@@ -577,12 +584,9 @@ static void wakeup_next_waiter(struct rt_mutex *lock, int savestate) ...@@ -577,12 +584,9 @@ static void wakeup_next_waiter(struct rt_mutex *lock, int savestate)
pendowner->pi_blocked_on = NULL; pendowner->pi_blocked_on = NULL;
if (rt_mutex_has_waiters(lock)) { if (next)
struct rt_mutex_waiter *next;
next = rt_mutex_top_waiter(lock);
plist_add(&next->pi_list_entry, &pendowner->pi_waiters); plist_add(&next->pi_list_entry, &pendowner->pi_waiters);
}
atomic_spin_unlock(&pendowner->pi_lock); atomic_spin_unlock(&pendowner->pi_lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment