Re: [PATCH v25 1/9] sched: Make class_schedulers avoid pushing current, and get rid of proxy_tag_curr()

John Stultz
2026-03-18T20:30:31Z

On Wed, Mar 18, 2026 at 6:36 AM Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Mon, Mar 16, 2026 at 11:04:28PM -0700, John Stultz wrote:
> > On Mon, Mar 16, 2026 at 10:41 PM K Prateek Nayak <kprateek.nayak@amd.com> wrote:
> > > On 3/17/2026 10:19 AM, John Stultz wrote:
> > > >
> > > > I guess adding a new helper function to manually do the
> > > > put_prev/set_next could be added to the top level __schedule() logic
> > > > in the (prev != next) case, though we'll have to preserve the
> > > > prev_donor on the stack probably.
> > >
> > > That seems like the best option to me too.
> > >
> > > Also, deadline, RT, fair, and idle don't really care about the "next"
> > > argument of put_prev_task() and the only one that does care is
> > > put_prev_task_scx() to call switch_class() callback so putting it as
> > > either NULL or "rq->donor" should be safe.
> >
> > Ack.
> > Here's the change I'm testing tonight (against 6.18):
> > https://github.com/johnstultz-work/linux-dev/commit/0cc72a4923143f496e33711cbcc1afdf6d861ca6
> >
> > Feel free to suggest a better name for the helper function. It feels a
> > little clunky (and sort of sad right after getting rid of the clunky
> > proxy_tag_curr(), to re-add something so similar).
>
> Does this capture it?

Yeah, this looks equivalent to what I had in my patch linked above.
I'll go ahead and take your version though.

The only tweak I might consider is setting the prev_donor along with
prev, so we don't have to move the rq_set_donor() call to be on both
sides of the sched_proxy_exec() conditional.

Feels much simpler to read, and I'd hope the compiler would optimize
the extra assignment away if it were unused at compile time. But maybe
there is a concern you have I'm missing?

thanks
-john