mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 0/2] PM: EM: Two cleanups related to em_check_capacity_update()
@ 2025-01-27 13:10 Rafael J. Wysocki
  2025-01-27 13:37 ` [PATCH v1 1/2] PM: EM: Drop unused parameter from em_adjust_new_capacity() Rafael J. Wysocki
  2025-01-27 13:38 ` [PATCH v1 2/2] PM: EM: Slightly reduce em_check_capacity_update() overhead Rafael J. Wysocki
  0 siblings, 2 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2025-01-27 13:10 UTC (permalink / raw)
  To: Linux PM; +Cc: Lukasz Luba, LKML, Dietmar Eggemann, Ricardo Neri

Hi Everyone,

The first of these patches gets rid of an unused function parameter and the
other one reduces em_check_capacity_update() a bit.

Thanks!




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 1/2] PM: EM: Drop unused parameter from em_adjust_new_capacity()
  2025-01-27 13:10 [PATCH v1 0/2] PM: EM: Two cleanups related to em_check_capacity_update() Rafael J. Wysocki
@ 2025-01-27 13:37 ` Rafael J. Wysocki
  2025-02-10 11:25   ` Lukasz Luba
  2025-01-27 13:38 ` [PATCH v1 2/2] PM: EM: Slightly reduce em_check_capacity_update() overhead Rafael J. Wysocki
  1 sibling, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2025-01-27 13:37 UTC (permalink / raw)
  To: Linux PM; +Cc: Lukasz Luba, LKML, Dietmar Eggemann, Ricardo Neri

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

The max_cap parameter is never used in em_adjust_new_capacity(), so
drop it.

No functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 kernel/power/energy_model.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -728,8 +728,7 @@
  * are correctly calculated.
  */
 static void em_adjust_new_capacity(struct device *dev,
-				   struct em_perf_domain *pd,
-				   u64 max_cap)
+				   struct em_perf_domain *pd)
 {
 	struct em_perf_table __rcu *em_table;
 
@@ -800,7 +799,7 @@
 			 cpu, cpu_capacity, em_max_perf);
 
 		dev = get_cpu_device(cpu);
-		em_adjust_new_capacity(dev, pd, cpu_capacity);
+		em_adjust_new_capacity(dev, pd);
 	}
 
 	free_cpumask_var(cpu_done_mask);




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 2/2] PM: EM: Slightly reduce em_check_capacity_update() overhead
  2025-01-27 13:10 [PATCH v1 0/2] PM: EM: Two cleanups related to em_check_capacity_update() Rafael J. Wysocki
  2025-01-27 13:37 ` [PATCH v1 1/2] PM: EM: Drop unused parameter from em_adjust_new_capacity() Rafael J. Wysocki
@ 2025-01-27 13:38 ` Rafael J. Wysocki
  2025-02-10 11:26   ` Lukasz Luba
  1 sibling, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2025-01-27 13:38 UTC (permalink / raw)
  To: Linux PM; +Cc: Lukasz Luba, LKML, Dietmar Eggemann, Ricardo Neri

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Every iteration of the loop over all possible CPUs in
em_check_capacity_update() causes get_cpu_device() to be called twice
for the same CPU, once indirectly via em_cpu_get() and once directly.

Get rid of the indirect get_cpu_device() call by moving the direct
invocation of it earlier and using em_pd_get() instead of em_cpu_get()
to get a pd pointer for the dev one returned by it.

This also exposes the fact that dev is needed to get a pd, so the code
becomes somewhat easier to follow after it.

No functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 kernel/power/energy_model.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -774,7 +774,8 @@
 		}
 		cpufreq_cpu_put(policy);
 
-		pd = em_cpu_get(cpu);
+		dev = get_cpu_device(cpu);
+		pd = em_pd_get(dev);
 		if (!pd || em_is_artificial(pd))
 			continue;
 
@@ -798,7 +799,6 @@
 		pr_debug("updating cpu%d cpu_cap=%lu old capacity=%lu\n",
 			 cpu, cpu_capacity, em_max_perf);
 
-		dev = get_cpu_device(cpu);
 		em_adjust_new_capacity(dev, pd);
 	}
 




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/2] PM: EM: Drop unused parameter from em_adjust_new_capacity()
  2025-01-27 13:37 ` [PATCH v1 1/2] PM: EM: Drop unused parameter from em_adjust_new_capacity() Rafael J. Wysocki
@ 2025-02-10 11:25   ` Lukasz Luba
  0 siblings, 0 replies; 5+ messages in thread
From: Lukasz Luba @ 2025-02-10 11:25 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: LKML, Linux PM, Dietmar Eggemann, Ricardo Neri



On 1/27/25 13:37, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> The max_cap parameter is never used in em_adjust_new_capacity(), so
> drop it.
> 
> No functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>   kernel/power/energy_model.c |    5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> --- a/kernel/power/energy_model.c
> +++ b/kernel/power/energy_model.c
> @@ -728,8 +728,7 @@
>    * are correctly calculated.
>    */
>   static void em_adjust_new_capacity(struct device *dev,
> -				   struct em_perf_domain *pd,
> -				   u64 max_cap)
> +				   struct em_perf_domain *pd)
>   {
>   	struct em_perf_table __rcu *em_table;
>   
> @@ -800,7 +799,7 @@
>   			 cpu, cpu_capacity, em_max_perf);
>   
>   		dev = get_cpu_device(cpu);
> -		em_adjust_new_capacity(dev, pd, cpu_capacity);
> +		em_adjust_new_capacity(dev, pd);
>   	}
>   
>   	free_cpumask_var(cpu_done_mask);
> 
> 
> 

LGTM

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 2/2] PM: EM: Slightly reduce em_check_capacity_update() overhead
  2025-01-27 13:38 ` [PATCH v1 2/2] PM: EM: Slightly reduce em_check_capacity_update() overhead Rafael J. Wysocki
@ 2025-02-10 11:26   ` Lukasz Luba
  0 siblings, 0 replies; 5+ messages in thread
From: Lukasz Luba @ 2025-02-10 11:26 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: LKML, Linux PM, Dietmar Eggemann, Ricardo Neri



On 1/27/25 13:38, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Every iteration of the loop over all possible CPUs in
> em_check_capacity_update() causes get_cpu_device() to be called twice
> for the same CPU, once indirectly via em_cpu_get() and once directly.
> 
> Get rid of the indirect get_cpu_device() call by moving the direct
> invocation of it earlier and using em_pd_get() instead of em_cpu_get()
> to get a pd pointer for the dev one returned by it.
> 
> This also exposes the fact that dev is needed to get a pd, so the code
> becomes somewhat easier to follow after it.
> 
> No functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>   kernel/power/energy_model.c |    4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- a/kernel/power/energy_model.c
> +++ b/kernel/power/energy_model.c
> @@ -774,7 +774,8 @@
>   		}
>   		cpufreq_cpu_put(policy);
>   
> -		pd = em_cpu_get(cpu);
> +		dev = get_cpu_device(cpu);
> +		pd = em_pd_get(dev);
>   		if (!pd || em_is_artificial(pd))
>   			continue;
>   
> @@ -798,7 +799,6 @@
>   		pr_debug("updating cpu%d cpu_cap=%lu old capacity=%lu\n",
>   			 cpu, cpu_capacity, em_max_perf);
>   
> -		dev = get_cpu_device(cpu);
>   		em_adjust_new_capacity(dev, pd);
>   	}
>   
> 
> 
> 


LGTM

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-10 11:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-27 13:10 [PATCH v1 0/2] PM: EM: Two cleanups related to em_check_capacity_update() Rafael J. Wysocki
2025-01-27 13:37 ` [PATCH v1 1/2] PM: EM: Drop unused parameter from em_adjust_new_capacity() Rafael J. Wysocki
2025-02-10 11:25   ` Lukasz Luba
2025-01-27 13:38 ` [PATCH v1 2/2] PM: EM: Slightly reduce em_check_capacity_update() overhead Rafael J. Wysocki
2025-02-10 11:26   ` Lukasz Luba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®