Re: [PATCH v7] sched_ext: idle: Refresh idle masks during idle-to-idle transitions
From: Andrea Righi
Date: Fri Jan 10 2025 - 16:41:06 EST
On Fri, Jan 10, 2025 at 11:37:07AM -1000, Tejun Heo wrote:
> Hello,
>
> On Fri, Jan 10, 2025 at 10:23:21PM +0100, Andrea Righi wrote:
> ...
> > + /*
> > + * Update the idle masks:
> > + * - for real idle transitions (do_notify == true)
> > + * - for idle-to-idle transitions (indicated by the previous task
> > + * being the idle thread, managed by pick_task_idle())
> > + *
> > + * Skip updating idle masks if the previous task is not the idle
> > + * thread, since set_next_task_idle() has already handled it when
> > + * transitioning from a task to the idle thread (calling this
> > + * function with do_notify == true).
> > + *
> > + * In this way we can avoid updating the idle masks twice,
> > + * unnecessarily.
> > + */
> > + if (do_notify || is_idle_task(rq->curr))
> > + update_idle_masks(cpu, idle);
>
> Sorry about the multiple nitpicks but wouldn't it be better to have the
> static_key test before dynamic tests? I'd move scx_builtin_idle_enabled test
> out of update_idle_masks() and put that in front of other tests here. Also,
> maybe name the function update_builtin_idle() to stay consistent with the
> static_key name? Otherwise looks good to me.
No problem, all makes sense to me. I'll apply these changes and send a v8.
Thanks for the review!
-Andrea