2020-11-23 10:21:41

by Pavankumar Kondeti

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Pavankumar Kondeti <[email protected]>
---
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 b67a51c..8810f1f 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
--
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.


2020-11-23 10:33:13

by Quentin Perret

[permalink] [raw]
Subject: Re: [PATCH] PM / EM: Micro optimization in em_pd_energy

Hi Pavan,

On Monday 23 Nov 2020 at 15:47:57 (+0530), Pavankumar Kondeti wrote:
> When the sum of the utilization of CPUs in a power domain is zero,

s/power/performance

> return the energy as 0 without doing any computations.
>
> Signed-off-by: Pavankumar Kondeti <[email protected]>
> ---
> 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 b67a51c..8810f1f 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

Makes sense to me, so with nit above:

Acked-by: Quentin Perret <[email protected]>

Thanks!
Quentin

2020-11-23 10:35:41

by Pavankumar Kondeti

[permalink] [raw]
Subject: [PATCH V2] 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.

Signed-off-by: Pavankumar Kondeti <[email protected]>
---
V2: Fixed the function name in the commit message.

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 b67a51c..8810f1f 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
--
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.

2020-11-23 10:39:11

by Pavankumar Kondeti

[permalink] [raw]
Subject: [PATCH V3] 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.

Signed-off-by: Pavankumar Kondeti <[email protected]>
---
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(+)

diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
index b67a51c..8810f1f 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
--
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.

2020-11-23 10:48:48

by Pavankumar Kondeti

[permalink] [raw]
Subject: Re: [PATCH] PM / EM: Micro optimization in em_pd_energy

On Mon, Nov 23, 2020 at 10:28:39AM +0000, Quentin Perret wrote:
> Hi Pavan,
>
> On Monday 23 Nov 2020 at 15:47:57 (+0530), Pavankumar Kondeti wrote:
> > When the sum of the utilization of CPUs in a power domain is zero,
>
> s/power/performance
>
> > return the energy as 0 without doing any computations.
> >
> > Signed-off-by: Pavankumar Kondeti <[email protected]>
> > ---
> > 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 b67a51c..8810f1f 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
>
> Makes sense to me, so with nit above:
>
> Acked-by: Quentin Perret <[email protected]>
>
Thanks Quentin. I have updated the patch as per your correction.

Thanks,
Pavan

--
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.

2020-11-24 15:02:39

by Dietmar Eggemann

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

On 23/11/2020 11:35, Pavankumar Kondeti wrote:
> When the sum of the utilization of CPUs in a performance domain is
> zero, return the energy as 0 without doing any computations.
>
> Signed-off-by: Pavankumar Kondeti <[email protected]>
> ---
> 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(+)
>
> diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
> index b67a51c..8810f1f 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


LGTM.

Reviewed-by: Dietmar Eggemann <[email protected]>

2020-11-24 23:46:02

by Wysocki, Rafael J

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

On 11/23/2020 11:29 AM, Pavankumar Kondeti wrote:
> When the sum of the utilization of CPUs in a power domain is zero,
> return the energy as 0 without doing any computations.
>
> Signed-off-by: Pavankumar Kondeti <[email protected]>
> ---
> V2: Fixed the function name in the commit message.
>
> 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 b67a51c..8810f1f 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

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!


2020-11-28 02:25:17

by Pavankumar Kondeti

[permalink] [raw]
Subject: [RESEND PATCH V3] 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 <[email protected]>
Reviewed-by: Dietmar Eggemann <[email protected]>
Signed-off-by: Pavankumar Kondeti <[email protected]>
---
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 b67a51c..8810f1f 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
--
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.

2020-12-08 17:28:57

by Rafael J. Wysocki

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

On Sat, Nov 28, 2020 at 3:21 AM Pavankumar Kondeti
<[email protected]> wrote:
>
> 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 <[email protected]>
> Reviewed-by: Dietmar Eggemann <[email protected]>
> Signed-off-by: Pavankumar Kondeti <[email protected]>
> ---
> 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 b67a51c..8810f1f 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
> --

Applied as 5.11 material, thanks!