diff mbox series

PM:EM: fix wrong utilization estimation in em_cpu_energy()

Message ID 20240404104200.1672208-1-vincent.guittot@linaro.org (mailing list archive)
State Mainlined, archived
Headers show
Series PM:EM: fix wrong utilization estimation in em_cpu_energy() | expand

Commit Message

Vincent Guittot April 4, 2024, 10:42 a.m. UTC
Commit 1b600da51073 ("PM: EM: Optimize em_cpu_energy() and remove division")
has added back map_util_perf() in em_cpu_energy() computation which has
been removed with the rework of scheduler/cpufreq interface.
This is wrong because sugov_effective_cpu_perf() already takes care of
mapping the utilization to a performance level.

Fixes: 1b600da51073 ("PM: EM: Optimize em_cpu_energy() and remove division")
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
---
 include/linux/energy_model.h | 1 -
 1 file changed, 1 deletion(-)

Comments

Lukasz Luba April 4, 2024, 11:05 a.m. UTC | #1
Hi Vincent,

On 4/4/24 11:42, Vincent Guittot wrote:
> Commit 1b600da51073 ("PM: EM: Optimize em_cpu_energy() and remove division")
> has added back map_util_perf() in em_cpu_energy() computation which has
> been removed with the rework of scheduler/cpufreq interface.
> This is wrong because sugov_effective_cpu_perf() already takes care of
> mapping the utilization to a performance level.
> 
> Fixes: 1b600da51073 ("PM: EM: Optimize em_cpu_energy() and remove division")
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> ---
>   include/linux/energy_model.h | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
> index 770755df852f..70cd7258cd29 100644
> --- a/include/linux/energy_model.h
> +++ b/include/linux/energy_model.h
> @@ -245,7 +245,6 @@ static inline unsigned long em_cpu_energy(struct em_perf_domain *pd,
>   	 * max utilization to the allowed CPU capacity before calculating
>   	 * effective performance.
>   	 */
> -	max_util = map_util_perf(max_util);
>   	max_util = min(max_util, allowed_cpu_cap);
>   
>   	/*

LGTM. It was developed in parallel IIRC and that change which removes
the extra margin to the util was lost from my radar. I can see it
landed first.

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

Regards,
Lukasz
Rafael J. Wysocki April 4, 2024, 7:05 p.m. UTC | #2
On Thu, Apr 4, 2024 at 1:05 PM Lukasz Luba <lukasz.luba@arm.com> wrote:
>
> Hi Vincent,
>
> On 4/4/24 11:42, Vincent Guittot wrote:
> > Commit 1b600da51073 ("PM: EM: Optimize em_cpu_energy() and remove division")
> > has added back map_util_perf() in em_cpu_energy() computation which has
> > been removed with the rework of scheduler/cpufreq interface.
> > This is wrong because sugov_effective_cpu_perf() already takes care of
> > mapping the utilization to a performance level.
> >
> > Fixes: 1b600da51073 ("PM: EM: Optimize em_cpu_energy() and remove division")
> > Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> > ---
> >   include/linux/energy_model.h | 1 -
> >   1 file changed, 1 deletion(-)
> >
> > diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
> > index 770755df852f..70cd7258cd29 100644
> > --- a/include/linux/energy_model.h
> > +++ b/include/linux/energy_model.h
> > @@ -245,7 +245,6 @@ static inline unsigned long em_cpu_energy(struct em_perf_domain *pd,
> >        * max utilization to the allowed CPU capacity before calculating
> >        * effective performance.
> >        */
> > -     max_util = map_util_perf(max_util);
> >       max_util = min(max_util, allowed_cpu_cap);
> >
> >       /*
>
> LGTM. It was developed in parallel IIRC and that change which removes
> the extra margin to the util was lost from my radar. I can see it
> landed first.
>
> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

Applied as 6.9-rc material, thanks!
diff mbox series

Patch

diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
index 770755df852f..70cd7258cd29 100644
--- a/include/linux/energy_model.h
+++ b/include/linux/energy_model.h
@@ -245,7 +245,6 @@  static inline unsigned long em_cpu_energy(struct em_perf_domain *pd,
 	 * max utilization to the allowed CPU capacity before calculating
 	 * effective performance.
 	 */
-	max_util = map_util_perf(max_util);
 	max_util = min(max_util, allowed_cpu_cap);
 
 	/*