Re: [PATCH] sched_ext: Refresh idle state when kicking CPUs

From: Tejun Heo
Date: Fri Jan 03 2025 - 16:39:57 EST


Hello,

On Fri, Jan 03, 2025 at 09:55:14AM +0100, Andrea Righi wrote:
...
> > When the put_prev/set_next paths were reorganized, we lost the signal on the
> > CPU re-entering idle from idle. However, that signal is still available if
> > we hook into idle_class->pick_task(), right? So, if we move
> > update_idle(true) call there and make sure that we don't generate an event
> > on busy->busy transitions, we should be able to restore the previous
> > behavior?
>
> Which is basically what I did here:
> https://lore.kernel.org/lkml/20241015111539.12136-1-andrea.righi@xxxxxxxxx/
>
> We didn't fully like this, because it'd introduce unbalanced transitions,
> as update_idle(cpu, true) can be generated multiple times. But it's
> probably fine, at the end we would just restore the original behavior and
> it'd allow to solve both the "pick_idle + kick CPU" and the "kick from
> update_idle()" scenarios.
>
> If we like this approach I can send a new patch updating the comment to
> better clarify the scenarios that we are trying to solve. What do you
> think?

Maybe we can solve the unbalanced transitions by tracking per-cpu idle state
separately and invoking ops.update_idle() only on actual transitions?

Thanks.

--
tejun