Re: [PATCH v7] sched_ext: idle: Refresh idle masks during idle-to-idle transitions
From: Tejun Heo
Date: Fri Jan 10 2025 - 16:37:14 EST
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.
Thanks.
--
tejun