From 5ed9ed016402727efb4cb3bdd2c2627ef7c9760c Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Sat, 28 Nov 2020 07:09:23 +0530 Subject: [PATCH] UPSTREAM: 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 (cherry picked from commit 9cc7e96aa846f9086431d6c2d33ff9ab42d72b2d) Bug: 173981595 Signed-off-by: Pavankumar Kondeti Change-Id: I9b1a83d210c30a8a86da26f94ac0c2f855d2ed10 --- 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 b67a51c574b9..8810f1fb2192 100644 --- a/include/linux/energy_model.h +++ b/include/linux/energy_model.h @@ -103,6 +103,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