From: Pavankumar Kondeti Date: Sat, 28 Nov 2020 01:39:23 +0000 (+0530) Subject: PM / EM: Micro optimization in em_cpu_energy X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1080399542075bb0e9d46ea80418d76784d1ece8;p=linux.git PM / EM: Micro optimization in em_cpu_energy When the sum of the utilization of CPUs in a power domain is zero, return the energy as 0 without doing any computations. Acked-by: Quentin Perret Reviewed-by: Dietmar Eggemann Signed-off-by: Pavankumar Kondeti Signed-off-by: Rafael J. Wysocki --- diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h index 9618c0a46ef41..757fc60658fa6 100644 --- a/include/linux/energy_model.h +++ b/include/linux/energy_model.h @@ -106,6 +106,9 @@ static inline unsigned long em_cpu_energy(struct em_perf_domain *pd, struct em_perf_state *ps; int i, cpu; + if (!sum_util) + return 0; + /* * In order to predict the performance state, map the utilization of * the most utilized CPU of the performance domain to a requested