Re: [RFC] RT-patch update to remove the global pi_lock

Daniel Walker
2005-08-22T22:21:42Z

On Mon, 2005-08-22 at 15:44 -0400, Steven Rostedt wrote:
> On Mon, 2005-08-22 at 20:33 +0200, Ingo Molnar wrote:
>
> > any ideas how to get rid of pi_lock altogether?
>
> I've toyed with the idea of adding another raw_spin_lock to the mutex. A
> lock specific pi_lock. Instead of grabbing a global pi_lock, grab the
> pi_lock of a lock. To modify any lock w.r.t PI, you must first grab all
> the lock's pi_locks being referenced.

Are you saying that you want to convert the current system to lock all
the pi_locks for all the locks in the sequence?

It seems like you could make it a per task lock, then only lock the
task's pi_lock for pi operations.

> The idea stems from the fact that the kernel must order its taking of
> locks to prevent deadlocks. This way the order of locks that are taken
> are also always in order.
>
> So if you have the following case:
>
> P1 blocked_on L1 owned_by P2 blocked_on L2 owned_by P3 ...
>
> The L1, L2, L3 ... must always be in the same order, otherwise the
> kernel itself can have a deadlock.
>
> OK, let me prove this (for myself as well ;-)
>
> Lets go by contradiction.

Proof seems straight forward enough.

One downside would be an increase in mutex structure size though.

Daniel