Re: [PATCH 1/2] sched_ext: Initialize idle masks before ops.init()

From: Andrea Righi

Date: Fri Jul 31 2026 - 11:12:38 EST


Hi Kuba,

On Fri, Jul 31, 2026 at 10:47:30AM +0000, Kuba Piecuch wrote:
> Hi Andrea,
>
> On Fri Jul 31, 2026 at 8:59 AM UTC, Andrea Righi wrote:
> > @@ -59,11 +59,13 @@ static inline void init_sched_ext_class(void) {}
> > #endif /* CONFIG_SCHED_CLASS_EXT */
> >
> > #ifdef CONFIG_SCHED_CLASS_EXT
> > +DECLARE_STATIC_KEY_FALSE(scx_idle_tracking_enabled);
> > +
>
> I was originally thinking about reusing scx_builtin_idle_enabled here,
> apologies if I wasn't clear enough.
>
> My reasoning is: If the user is doing their own idle CPU tracking,
> in which case scx_builtin_idle_enable will be disabled, what's the point
> of SCX tracking idle CPUs?
>
> Do you see a scenario where using one static branch is problematic?

I think you're right, I added a separate key because __scx_update_idle() also
delivers ops.update_idle() callbacks, but we can retain the existing
scx_enabled() check for that case and use scx_builtin_idle_enabled only for
early tracking. So I don't see any reason to add a separate static key.

I'll rework this in v3.

Thanks,
-Andrea