Re: Sum of weights idea for CFS PI

From: Qais Yousef
Date: Tue Oct 04 2022 - 12:31:05 EST


On 10/03/22 12:27, Joel Fernandes wrote:
> There's a lot to unwind so I will reply in pieces after spending some time
> thinking about it, but just for this part:
>
> On 10/3/2022 12:14 PM, Qais Yousef wrote:
> >> In this case, there is no lock involved yet you have a dependency. But I don't
> >> mean to sound depressing, and just because there are cases like this does not
> >> mean we should not solve the lock-based ones. When I looked at Android, I saw
> >> that it uses futex directly from Android Runtime code instead of using pthread.
> >> So perhaps this can be trivially converted to FUTEX_LOCK_PI and then what we do
> >> in the kernel will JustWork(Tm) ?
> > I guess it will depend on individual libc implementation, but I thought all of
> > them use FUTEX under the hood for pthreads mutexes.
> >
> > Maybe we can add a bootparam to force all futexes to be FUTEX_LOCK_PI?
> >
>
> In the case of FUTEX_LOCK_PI, you have to store the TID of the 'lock owner' in
> the futex word to signify that lock is held.

Right. So userspace has to opt-in.

> That wont work for the case above, Producer/Consumer signalling each other on a
> bounded-buffer, right? That's not locking even though it is acquiring and
> release of a limited resource.

Yes but as I tried to point out I don't think proxy-execution handles this case
where you don't hold a lock explicitly. But I could be wrong. IIUC Sebastian's
understanding is similar to mine. Only 'locks' (FUTEX_LOCK_PI which ends up
using rt-mutex) do PI inheritance.

So this signaling scenario is a new class of problems that wasn't handled
before; to my understanding.


Thanks

--
Qais Yousef