Re: [RESEND][PATCH v21 2/6] sched/locking: Add blocked_on_state to provide necessary tri-state for proxy return-migration

From: John Stultz

Date: Tue Sep 23 2025 - 19:34:27 EST


On Thu, Sep 18, 2025 at 8:28 PM K Prateek Nayak <kprateek.nayak@xxxxxxx> wrote:
> On 9/19/2025 4:27 AM, John Stultz wrote:
> >> I didn't know that was possible! Neat. Since cleanup.h has a note
> >> reading:
> >>
> >> ... the expectation is that usage of "goto" and cleanup helpers is
> >> never mixed in the same function.
> >>
> >> are there any concerns w.r.t. compiler versions etc. or am I just being
> >> paranoid?
> >
> > Hrrrrmmmm. I hadn't seen that detail. :/ I guess I was just lucky
> > it worked with my toolchain.
>
> I have been too. Maybe it is okay to use a goto if folks know what
> they are doing ¯\_(ツ)_/¯
>
> Another idea is to have:
>
> bool deactivate_donor = false;
>
> for (p = donor; task_is_blocked(p); p = owner) {
> guard(raw_spinlock)(...);
> ...
> if (<condition> {
> deactivate_donor = true;
> break;
> }
> ...
> }
> if (deactivate_donor)
> return proxy_deactivate(rq, donor);
>
> Can that work?

Yeah, I've reworked the logic to switch() on an action enum, which
will let us do something similar without gotos.

thanks
-john