Skip to contentSkip to conversation

PM / EM: Micro optimization in em_pd_energy

PATCH Superseded Pavankumar Kondeti 5 participants 9 messages Nov 23, 2020 – Dec 8, 2020 Energy model

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM / EM: Micro optimization in em_pd_energy

When the sum of the utilization of CPUs in a power domain is zero, return the energy as 0 without doing any computations.

---
 include/linux/energy_model.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/energy_model.h +3 -0
index b67a51c..8810f1f 100644
@@ -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
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
Acked-by on v1 1/1
#1 lore raw

Hi Pavan,

Quoted 1 line · Pavankumar Kondeti

When the sum of the utilization of CPUs in a power domain is zero,

s/power/performance

Quoted 12 lines

return the energy as 0 without doing any computations.

---
 include/linux/energy_model.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/energy_model.h +0 -0
index b67a51c..8810f1f 100644

include/linux/energy_model.h static inline unsigned long em_cpu_energy(struct em_perf_domain *pd, · line 111

Quoted 9 lines
include/linux/energy_model.h +3 -0
@@ -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

Makes sense to me, so with nit above:

Thanks!
Quentin

#2 lore raw
Quoted 31 lines · Quentin Perret

Hi Pavan,

Quoted 1 line · Pavankumar Kondeti

When the sum of the utilization of CPUs in a power domain is zero,

s/power/performance

Quoted 12 lines

return the energy as 0 without doing any computations.

---
 include/linux/energy_model.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/energy_model.h +0 -0
index b67a51c..8810f1f 100644

include/linux/energy_model.h static inline unsigned long em_cpu_energy(struct em_perf_domain *pd, · line 111

Quoted 9 lines
include/linux/energy_model.h +3 -0
@@ -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

Makes sense to me, so with nit above:

Quoted 2 lines

Thanks Quentin. I have updated the patch as per your correction.

Thanks,
Pavan

Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#3 lore raw

PATCH v2 1/1 PM / EM: Micro optimization in em_cpu_energy

In reply to Pavankumar Kondeti

When the sum of the utilization of CPUs in a power domain is zero, return the energy as 0 without doing any computations.

---
V2: Fixed the function name in the commit message.

 include/linux/energy_model.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/energy_model.h +3 -0
index b67a51c..8810f1f 100644
@@ -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
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#4 lore raw

PATCH v3 1/1 PM / EM: Micro optimization in em_cpu_energy

When the sum of the utilization of CPUs in a performance domain is zero, return the energy as 0 without doing any computations.

---
V3: %s/power/performance as corrected by Quentin
V2: Fixed the function name in the commit message.

 include/linux/energy_model.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/energy_model.h +3 -0
index b67a51c..8810f1f 100644
@@ -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
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
Reviewed-by on v3 1/1
#5 lore raw

Re: [PATCH V3] PM / EM: Micro optimization in em_cpu_energy

Quoted 16 lines · Pavankumar Kondeti

When the sum of the utilization of CPUs in a performance domain is zero, return the energy as 0 without doing any computations.

---
V3: %s/power/performance as corrected by Quentin
V2: Fixed the function name in the commit message.

 include/linux/energy_model.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/energy_model.h +0 -0
index b67a51c..8810f1f 100644

include/linux/energy_model.h static inline unsigned long em_cpu_energy(struct em_perf_domain *pd, · line 111

Quoted 9 lines
include/linux/energy_model.h +3 -0
@@ -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

LGTM.

#6 lore raw

Re: [PATCH V2] PM / EM: Micro optimization in em_cpu_energy

In reply to Pavankumar Kondeti
Quoted 15 lines · Pavankumar Kondeti

When the sum of the utilization of CPUs in a power domain is zero, return the energy as 0 without doing any computations.

---
V2: Fixed the function name in the commit message.

  include/linux/energy_model.h | 3 +++
  1 file changed, 3 insertions(+)
include/linux/energy_model.h +0 -0
index b67a51c..8810f1f 100644

include/linux/energy_model.h static inline unsigned long em_cpu_energy(struct em_perf_domain *pd, · line 111

Quoted 9 lines
include/linux/energy_model.h +3 -0
@@ -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

If I'm to take this, please resend it with a CC to [email protected] (and with the tags you've received so far).

Thanks!

#7 lore raw

PATCH RESEND v3 1/1 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.

---
 include/linux/energy_model.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/energy_model.h +3 -0
index b67a51c..8810f1f 100644
@@ -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
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer Applied
#8 lore raw

Re: [RESEND PATCH V3] PM / EM: Micro optimization in em_cpu_energy

Quoted 16 lines · Pavankumar Kondeti

When the sum of the utilization of CPUs in a power domain is zero, return the energy as 0 without doing any computations.

---
 include/linux/energy_model.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/energy_model.h +0 -0
index b67a51c..8810f1f 100644

include/linux/energy_model.h static inline unsigned long em_cpu_energy(struct em_perf_domain *pd,

Quoted 10 lines
include/linux/energy_model.h +3 -1
@@ -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
--

Applied as 5.11 material, thanks!