Re: [PATCH 18/18 v2] sched/fair: Take into account slice in EAS
From: Kayra Cizmeci
Date: Wed Oct 07 2026 - 10:47:45 EST
> When the cost is the same, take into account the slice of a task to try to
> select a CPU where is will run first.
'is'? It gives 'it' vibes more of 'is' vibes... (:>)
> static bool update_best_cpu(struct energy_cpu_stat *target,
> struct energy_cpu_stat *min,
> - int prev, struct sched_domain *sd)
> + int prev, struct sched_domain *sd,
> + struct task_struct *p)
> {
> + unsigned long task_slice = p->se.slice;
> +
> + /* Select the one where you can run first */
Again. A typo. An extra blank. I'll normally make a joke but,
I'm tired. ;-)
> + if (task_slice < get_rq_min_slice(cpu_rq(target->cpu)) &&
> + task_slice >= get_rq_min_slice(cpu_rq(min->cpu)))
> + return true;
> +
> + /* Favor previous CPU */
> if (target->cpu == prev)
> return true;
> if (min->cpu == prev)
> @@ -9762,7 +9771,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
> */
> if (target_perf < min_stat.min_perf)
> find_pd_cost(pd->em_pd, target_perf, &target_stat);
> - else if (!update_best_cpu(&target_stat, &min_stat, prev_cpu, sd))
> + else if (!update_best_cpu(&target_stat, &min_stat, prev_cpu, sd, p))
> continue;
>
> /* Save the new most efficient CPU of the PD */
Also,
Scene:
On the reworked version of feec(), we have this check:
if (p->on_rq && !p->se.sched_delayed && cpu == prev_cpu)
A little after and outside of this check, we call update_best_cpu().
Now, if this check can get true, on this state:
prev's min_slice cannot be bigger than p's task_slice.
So when target is prev the first check is always false,
and when min->cpu is prev, the second check is always true.
Also also, I have a really important issue abot the patch
series that can finish the whole patch series and end the world
itself...
The issue is...
I need to sleep.
Thanks,
Kayra