Messages in this thread Patch in this message | | | Date | Fri, 6 Jun 2014 10:25:15 -0400 | From | Steven Rostedt <> | Subject | Re: [patch 2/2] rtmutex: Detect changes in the pi lock chain |
| |
On Thu, 05 Jun 2014 15:28:33 -0000 Thomas Gleixner <tglx@linutronix.de> wrote: > @@ -536,8 +569,9 @@ static int task_blocks_on_rt_mutex(struc > { > struct task_struct *owner = rt_mutex_owner(lock); > struct rt_mutex_waiter *top_waiter = waiter; > + struct rt_mutex *next_lock = NULL; > unsigned long flags; > - int chain_walk = 0, res; > + int chain_walk, res; > > /* > * Early deadlock detection. We really don't want the task to > @@ -569,19 +603,21 @@ static int task_blocks_on_rt_mutex(struc > if (!owner) > return 0; > > + raw_spin_lock_irqsave(&owner->pi_lock, flags); > if (waiter == rt_mutex_top_waiter(lock)) { > - raw_spin_lock_irqsave(&owner->pi_lock, flags); > rt_mutex_dequeue_pi(owner, top_waiter); > rt_mutex_enqueue_pi(owner, waiter); > > __rt_mutex_adjust_prio(owner); > if (owner->pi_blocked_on) > chain_walk = 1; > - raw_spin_unlock_irqrestore(&owner->pi_lock, flags); > - } > - else if (debug_rt_mutex_detect_deadlock(waiter, detect_deadlock)) > + } else if (debug_rt_mutex_detect_deadlock(waiter, detect_deadlock)) { > chain_walk = 1; > + } > + if (owner->pi_blocked_on) > + next_lock = owner->pi_blocked_on->lock; > > + raw_spin_unlock_irqrestore(&owner->pi_lock, flags); > if (!chain_walk) > return 0;
Here's another optimization:
/* If the owner is not blocked, no need to walk the chain */ if (!chain_walk || !next_lock) return 0;
-- Steve
| |