[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140515173937.402a9fae@gandalf.local.home>
Date: Thu, 15 May 2014 17:39:37 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Lai Jiangshan <laijs@...fujitsu.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>
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@...utronix.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);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists