2024-04-25 07:38:31

by Vincent Guittot

[permalink] [raw]
Subject: [PATCH] arch/topology: Fix variable naming

Using hw_pressure for local variable is confusing in regard to the
per_cpu hw_pressure variable. Rename it to avoid confusion.

Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Vincent Guittot <[email protected]>
---

drivers/base/arch_topology.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index 0248912ff687..c66d070207a0 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -179,7 +179,7 @@ DEFINE_PER_CPU(unsigned long, hw_pressure);
void topology_update_hw_pressure(const struct cpumask *cpus,
unsigned long capped_freq)
{
- unsigned long max_capacity, capacity, hw_pressure;
+ unsigned long max_capacity, capacity, pressure;
u32 max_freq;
int cpu;

@@ -196,12 +196,12 @@ void topology_update_hw_pressure(const struct cpumask *cpus,
else
capacity = mult_frac(max_capacity, capped_freq, max_freq);

- hw_pressure = max_capacity - capacity;
+ pressure = max_capacity - capacity;

- trace_hw_pressure_update(cpu, hw_pressure);
+ trace_hw_pressure_update(cpu, pressure);

for_each_cpu(cpu, cpus)
- WRITE_ONCE(per_cpu(hw_pressure, cpu), hw_pressure);
+ WRITE_ONCE(per_cpu(hw_pressure, cpu), pressure);
}
EXPORT_SYMBOL_GPL(topology_update_hw_pressure);

--
2.34.1



2024-04-25 08:17:03

by Lukasz Luba

[permalink] [raw]
Subject: Re: [PATCH] arch/topology: Fix variable naming



On 4/25/24 08:37, Vincent Guittot wrote:
> Using hw_pressure for local variable is confusing in regard to the
> per_cpu hw_pressure variable. Rename it to avoid confusion.
>
> Reported-by: kernel test robot <[email protected]>
> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> Signed-off-by: Vincent Guittot <[email protected]>
> ---
>
> drivers/base/arch_topology.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
> index 0248912ff687..c66d070207a0 100644
> --- a/drivers/base/arch_topology.c
> +++ b/drivers/base/arch_topology.c
> @@ -179,7 +179,7 @@ DEFINE_PER_CPU(unsigned long, hw_pressure);
> void topology_update_hw_pressure(const struct cpumask *cpus,
> unsigned long capped_freq)
> {
> - unsigned long max_capacity, capacity, hw_pressure;
> + unsigned long max_capacity, capacity, pressure;
> u32 max_freq;
> int cpu;
>
> @@ -196,12 +196,12 @@ void topology_update_hw_pressure(const struct cpumask *cpus,
> else
> capacity = mult_frac(max_capacity, capped_freq, max_freq);
>
> - hw_pressure = max_capacity - capacity;
> + pressure = max_capacity - capacity;
>
> - trace_hw_pressure_update(cpu, hw_pressure);
> + trace_hw_pressure_update(cpu, pressure);
>
> for_each_cpu(cpu, cpus)
> - WRITE_ONCE(per_cpu(hw_pressure, cpu), hw_pressure);
> + WRITE_ONCE(per_cpu(hw_pressure, cpu), pressure);
> }
> EXPORT_SYMBOL_GPL(topology_update_hw_pressure);
>

Make sense

Reviewed-by: Lukasz Luba <[email protected]>

2024-04-25 08:47:01

by Sudeep Holla

[permalink] [raw]
Subject: Re: [PATCH] arch/topology: Fix variable naming

On Thu, Apr 25, 2024 at 09:37:09AM +0200, Vincent Guittot wrote:
> Using hw_pressure for local variable is confusing in regard to the
> per_cpu hw_pressure variable. Rename it to avoid confusion.
>

Acked-by: Sudeep Holla <[email protected]>

--
Regards,
Sudeep

2024-04-30 12:19:22

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH] arch/topology: Fix variable naming



On 25.04.2024 9:37 AM, Vincent Guittot wrote:
> Using hw_pressure for local variable is confusing in regard to the
> per_cpu hw_pressure variable. Rename it to avoid confusion.

To avoid confusing the compiler :P

>
> Reported-by: kernel test robot <[email protected]>
> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> Signed-off-by: Vincent Guittot <[email protected]>
> ---

Fixes: d4dbc991714e ("sched/cpufreq: Rename arch_update_thermal_pressure() => arch_update_hw_pressure()")
Tested-by: Konrad Dybcio <[email protected]> # QC SM8550 QRD
Reviewed-by: Konrad Dybcio <[email protected]>

Konrad