Messages in this thread Patch in this message | | | Date | Thu, 15 May 2014 17:39:37 -0400 | From | Steven Rostedt <> | Subject | Re: [patch 2/2] rtmutex: Avoid pointless requeueing in the deadlock detection chain walk |
| |
On Wed, 14 May 2014 20:03:27 -0000 Thomas Gleixner <tglx@linutronix.de> wrote: > /* Release the task */ > raw_spin_unlock_irqrestore(&task->pi_lock, flags); > + /* > + * We must abort the chain walk if there is no lock owner even > + * in the dead lock detection case, as we have nothing to > + * follow here. > + */ > if (!rt_mutex_owner(lock)) { > /* > * If the requeue above changed the top waiter, then we need > * to wake the new top waiter up to try to get the lock. > */ > - > if (top_waiter != rt_mutex_top_waiter(lock)) > wake_up_process(rt_mutex_top_waiter(lock)->task);
Seems we can change the above if condition to:
if (requeue && top_waiter != rt_mutex_top_waiter(lock))
as there was no "requeue above" that could change anything.
-- Steve
> raw_spin_unlock(&lock->wait_lock); > @@ -404,18 +413,20 @@ static int rt_mutex_adjust_prio_chain(st > get_task_struct(task); > raw_spin_lock_irqsave(&task->pi_lock, flags); > > - if (waiter == rt_mutex_top_waiter(lock)) { > - /* Boost the owner */ > - rt_mutex_dequeue_pi(task, top_waiter); > - rt_mutex_enqueue_pi(task, waiter); > - __rt_mutex_adjust_prio(task); > - > - } else if (top_waiter == waiter) { > - /* Deboost the owner */ > - rt_mutex_dequeue_pi(task, waiter); > - waiter = rt_mutex_top_waiter(lock); > - rt_mutex_enqueue_pi(task, waiter); > - __rt_mutex_adjust_prio(task); > + if (requeue) { > + if (waiter == rt_mutex_top_waiter(lock)) { > + /* Boost the owner */ > + rt_mutex_dequeue_pi(task, top_waiter); > + rt_mutex_enqueue_pi(task, waiter); > + __rt_mutex_adjust_prio(task); > + > + } else if (top_waiter == waiter) { > + /* Deboost the owner */ > + rt_mutex_dequeue_pi(task, waiter); > + waiter = rt_mutex_top_waiter(lock); > + rt_mutex_enqueue_pi(task, waiter); > + __rt_mutex_adjust_prio(task); > + } > } > > raw_spin_unlock_irqrestore(&task->pi_lock, flags); >
| |