lkml.org 
[lkml]   [2015]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH RT 0/3] RT: Fix trylock deadlock without msleep() hack

* Thomas Gleixner <tglx@linutronix.de> wrote:

> So the problem we need to solve is:
>
> retry:
> lock(B);
> if (!try_lock(A)) {
> unlock(B);
> cpu_relax();
> goto retry;
> }
>
> So instead of doing that proposed magic boost, we can do something
> more straight forward:
>
> retry:
> lock(B);
> if (!try_lock(A)) {
> lock_and_drop(A, B);
> unlock(A);
> goto retry;
> }
>
> lock_and_drop() queues the task as a waiter on A, drops B and then
> does the PI adjustment on A.
>
> Thoughts?

So why not do:

lock(B);
if (!trylock(A)) {
unlock(B);
lock(A);
lock(B);
}

?

Or, if this can be done, why didn't we do:

lock(A);
lock(B);

to begin with?

i.e. I'm not sure the problem is properly specified.

Thanks,

Ingo


\
 
 \ /
  Last update: 2015-09-05 14:21    [W:0.093 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site