From 8a306ac79d4768c8654e5cd09e2c01da2381c88b Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Mon, 23 Sep 2019 14:38:35 +0530 Subject: [PATCH] PM / EM: Micro optimization in em_pd_energy If the sum of the utilization of CPUs in a power domain is zero, return the energy as 0 instead of doing any math. Change-Id: I9b1a83d210c30a8a86da26f94ac0c2f855d2ed10 Signed-off-by: Pavankumar Kondeti --- include/linux/energy_model.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h index 73f8c3cb9588..82cd68bbb8f5 100644 --- a/include/linux/energy_model.h +++ b/include/linux/energy_model.h @@ -83,6 +83,9 @@ static inline unsigned long em_pd_energy(struct em_perf_domain *pd, struct em_cap_state *cs; int i, cpu; + if (!sum_util) + return 0; + /* * In order to predict the capacity state, map the utilization of the * most utilized CPU of the performance domain to a requested frequency,