Adaptive-locking technology often times acquires the lock byspinning on a running-owner instead of sleeping. It is unecessaryto go through pi-boosting if the owner is of equal or (logically)lower priority. Therefore, we can save some significant overheadby deferring the boost until absolutely necessary. This has shownto improve overall performance in PREEMPT_RT

Special thanks to Peter Morreale for suggesting the optimization toonly consider skipping the boost if the owner is >= to current

+ orig_owner = rt_mutex_owner(lock);+ /* * waiter.task is NULL the first time we come here and * when we have been woken up by the previous owner * but the lock got stolen by an higher prio task. */- if (!waiter.task) {- add_waiter(lock, &waiter, &flags);+ if (!waiter.task)+ _add_waiter(lock, &waiter);++ /*+ * We only need to pi-boost the owner if they are lower+ * priority than us. We dont care if this is racy+ * against priority changes as we will break out of+ * the adaptive spin anytime any priority changes occur+ * without boosting enabled.+ */+ if (!waiter.pi.boosted && current->prio < orig_owner->prio) {+ boost_lock(lock, &waiter);+ boosted = 1;++ spin_unlock_irqrestore(&lock->wait_lock, flags);+ task_pi_update(current, 0);+ spin_lock_irqsave(&lock->wait_lock, flags);+ /* Wakeup during boost ? */ if (unlikely(!waiter.task)) continue; }