Commit c3c6a61d authored by Steven Rostedt's avatar Steven Rostedt Committed by Thomas Gleixner

rtmutex: break out early on first run

Lock stealing and non cmpxchg will always go into the slow path.
This patch detects the fact that we didn't go through the work of
blocking and will exit early.
Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 73d33caf
...@@ -768,6 +768,7 @@ rt_spin_lock_slowlock(struct rt_mutex *lock) ...@@ -768,6 +768,7 @@ rt_spin_lock_slowlock(struct rt_mutex *lock)
struct rt_mutex_waiter waiter; struct rt_mutex_waiter waiter;
unsigned long saved_state, state, flags; unsigned long saved_state, state, flags;
struct task_struct *orig_owner; struct task_struct *orig_owner;
int missed = 0;
debug_rt_mutex_init_waiter(&waiter); debug_rt_mutex_init_waiter(&waiter);
waiter.task = NULL; waiter.task = NULL;
...@@ -792,8 +793,14 @@ rt_spin_lock_slowlock(struct rt_mutex *lock) ...@@ -792,8 +793,14 @@ rt_spin_lock_slowlock(struct rt_mutex *lock)
int saved_lock_depth = current->lock_depth; int saved_lock_depth = current->lock_depth;
/* Try to acquire the lock */ /* Try to acquire the lock */
if (do_try_to_take_rt_mutex(lock, STEAL_LATERAL)) if (do_try_to_take_rt_mutex(lock, STEAL_LATERAL)) {
/* If we never blocked break out now */
if (!missed)
goto unlock;
break; break;
}
missed = 1;
/* /*
* waiter.task is NULL the first time we come here and * waiter.task is NULL the first time we come here and
* when we have been woken up by the previous owner * when we have been woken up by the previous owner
...@@ -850,6 +857,7 @@ rt_spin_lock_slowlock(struct rt_mutex *lock) ...@@ -850,6 +857,7 @@ rt_spin_lock_slowlock(struct rt_mutex *lock)
*/ */
fixup_rt_mutex_waiters(lock); fixup_rt_mutex_waiters(lock);
unlock:
atomic_spin_unlock_irqrestore(&lock->wait_lock, flags); atomic_spin_unlock_irqrestore(&lock->wait_lock, flags);
debug_rt_mutex_free_waiter(&waiter); debug_rt_mutex_free_waiter(&waiter);
......
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