Re: [PATCH v33 7/7] sched/proxy: Add deactivated (sleeping) owner handling to find_proxy_task()

From: John Stultz

Date: Thu Nov 26 2026 - 01:22:32 EST


On Wed, Oct 28, 2026 at 8:27 PM K Prateek Nayak <kprateek.nayak@xxxxxxx> wrote:
> On 10/28/2026 4:06 PM, Juri Lelli wrote:
> >> Ack! But this is only needed for wakeup so just:
> >>
> >> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> >> index c0ebdcde5fe5..20c388b55c50 100644
> >> --- a/kernel/sched/deadline.c
> >> +++ b/kernel/sched/deadline.c
> >> @@ -2657,7 +2657,7 @@ static void migrate_task_rq_dl(struct task_struct *p, int new_cpu __maybe_unused
> >> struct rq_flags rf;
> >> struct rq *rq;
> >>
> >> - if (READ_ONCE(p->__state) != TASK_WAKING)
> >> + if (task_on_rq_migrating(rq))
> >> return;
> >>
> >> rq = task_rq(p);
> >> ---
> >>
> >> should be enough then?
> >
> > It is enough, but I now fear too 'broad'? :)
> >
> > Looks like dl_task_offline_migration() ends up here via set_task_cpu();
> > in that case the task was throttled and found the cpu was running on has
> > been hotplugged so it needs a new cpu at replenishment. All bandwidth
> > accouting is done by dl_task_offline_migration() itself, the task is not
> > WAKING so migrate_task_rq_dl() has nothing to do and bails early
> > correctly. If we use task_on_rq_migrating() it won't bail early anymore
> > and double subtracting? Adding !p->is_blocked seems to cover this case
> > as well?
>
> Ack! '!task_on_migrating(p) && p->is_blocked' should cover all cases.
>
> That said, the way dl_task_offline_migration() migrates the throttled
> task off an offline rq is interesting :-)

Juri, K Prateek!
Sorry to not get to participate in this while the discussion was
going on. In the patchset I'm working up now, I've got a chance that
does call p->sched_class->migrate_task_rq() downstream of
proxy_set_task_cpu(), which partially addresses Andrea's original
concern, and I'm going to add another patch to tweak
migrate_task_rq_dl() to soften its check so we don't bail out early on
p->is_blocked && !task_on_rq_migrating(p) as suggested by you two.

Thanks so much for your review and constructive suggestions and feedback here!
-john