Re: [PATCH] sched: Do not release current rq lock on non contended double_lock_balance()

From: Steven Rostedt
Date: Tue Jun 14 2016 - 13:52:54 EST


>
> > CPU 0 CPU 1
> > ----- -----
> > [ wake up ]
> > spin_lock(cpu1_rq->lock);
> > spin_lock(cpu1_rq->lock)
> > double_lock_balance()
> > [ release cpu1_rq->lock ]
> > spin_lock(cpu1_rq->lock)
> > [due to ticket, now acquires
> > cpu1_rq->lock ]
> >
> > [goes to push task]
> > double_lock_balance()
> > [ release cpu1_rq->lock ]
> > [ acquires lock ]
> > spin_lock(cpu2_rq->lock)
> > [ blocks as cpu2 is using it ]
> >
>
> Also, its not entirely clear this scenario helps illustrate how your
> change is better; because here the lock _is_ contended, so we'll fail
> the trylock, no?

Sorry, I should have been more specific that the double lock balance
was grabbing cpu2_rq (another rq lock), where there was no contention.

-- Steve