Messages in this thread | | | From | Xuewen Yan <> | Date | Fri, 22 Oct 2021 12:05:27 +0800 | Subject | Re: [RFC PATCH] sched/fair: use max_spare_cap_cpu if it is more energy efficient |
| |
Hi Chunguang
brookxu <brookxu.cn@gmail.com> 于2021年10月21日周四 下午4:24写道: > > From: Chunguang Xu <brookxu@tencent.com> > > When debugging EAS, I found that if the task is migrated to > max_spare_cap_cpu, even if the power consumption of pd is lower, > we still put the task on prev_cpu. Maybe we should fix it. > > Signed-off-by: Chunguang Xu <brookxu@tencent.com> > --- > kernel/sched/fair.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index ff69f245b939..2ae7e03de6d2 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -6867,8 +6867,10 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu) > /* Evaluate the energy impact of using max_spare_cap_cpu. */ > if (max_spare_cap_cpu >= 0) { > cur_delta = compute_energy(p, max_spare_cap_cpu, pd); > - if (cur_delta < base_energy_pd)
this is aimed to prevent the cur_delta < 0, and usuallly, when the task was put on the max_spare_cpu, the cur_power should be bigger than base_pd_power, if the cur_power < base_pd_power, the cpu util may have changed, at this time, we should keep prev_cpu.
You can look at below discuss and patch: https://lore.kernel.org/all/20210429101948.31224-3-Pierre.Gondois@arm.com/ https://lore.kernel.org/all/CAB8ipk_vgtg5d1obH36BYfNLZosbwr2k_U3xnAD4=H5uZt_M_g@mail.gmail.com/
> + if (cur_delta < base_energy_pd) { > + target = max_spare_cap_cpu; > goto unlock; > + } > cur_delta -= base_energy_pd; > if (cur_delta < best_delta) { > best_delta = cur_delta; > -- > 2.30.0 >
| |