Re: [RFC][PATCH 2/3] sched: Add support to pick functions to take rf
From: Peter Zijlstra
Date: Mon Oct 13 2025 - 07:09:16 EST
On Mon, Oct 13, 2025 at 01:04:49PM +0200, Peter Zijlstra wrote:
> Bah; so yeah, this new behaviour is better for indeed always calling
> newidle when it is needed, but you're also right that in case of ext
> this might not be ideal.
>
> So I have a pile of newidle hacks here:
>
> https://lkml.kernel.org/r/20251010170937.GG4067720@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> and while I don't particularly like NI_SPARE (the has_spare_tasks thing
> is fickle); the idea seems to have some merit for this situation --
> where we know we'll not be having fair tasks at all.
>
> I mean, we can always do something like this to sched_balance_newidle():
>
> if (scx_switched_all())
> return 0;
>
> Not pretty, but should do the job.
Oh, never mind, none of this is needed.
__pick_next_task()
if (scx_enabled())
goto restart;
...
restart:
for_each_active_class(class) {
...
}
And then we have next_active_class() skip fair_sched_class entirely when
scx_switch_all().
So in the common ext case, we'll not hit pick_next_task_fair() at all.