Re: [PATCH 03/12] sched: Fold sched_class::switch{ing,ed}_{to,from}() into the change pattern
From: Peter Zijlstra
Date: Thu Oct 09 2025 - 09:54:32 EST
On Thu, Oct 09, 2025 at 03:30:02PM +0200, Dietmar Eggemann wrote:
> On 06.10.25 12:44, Peter Zijlstra wrote:
> > Add {DE,EN}QUEUE_CLASS and fold the sched_class::switch* methods into
> > the change pattern. This completes and makes the pattern more
> > symmetric.
> >
> > This changes the order of callbacks slightly:
> >
> > |
> > | switching_from()
> > dequeue_task(); | dequeue_task()
> > put_prev_task(); | put_prev_task()
> > | switched_from()
> > |
> > ... change task ... | ... change task ...
> > |
> > switching_to(); | switching_to()
> > enqueue_task(); | enqueue_task()
> > set_next_task(); | set_next_task()
> > prev_class->switched_from() |
> > switched_to() | switched_to()
> > |
> >
> > Notably, it moves the switched_from() callback right after the
> > dequeue/put. Existing implementations don't appear to be affected by
> > this change in location -- specifically the task isn't enqueued on the
> > class in question in either location.
> >
> > Make (CLASS)^(SAVE|MOVE), because there is nothing to save-restore
> > when changing scheduling classes.
>
> This one causes a DL bw related warning when I run a simple 1 DL task
> rt-app workload:
> Not sure yet how this is related to switched_from_dl() being now called earlier?
Ooh, I might see a problem. task_non_contending() uses dl_task(), which
uses p->prio. The move above means it is now called using the 'old'
prio, whereas it used to run with the 'new' prio.
I suppose it does this to distinguish 'real' DL tasks from PI boosted DL
tasks.
Let me see if I can figure out something for this.