[PATCH 04/12] cpufreq/amd-pstate: Remove the redundant des_perf clamping in adjust_perf

Dhananjay Ugwekar posted 12 patches 10 months, 1 week ago
[PATCH 04/12] cpufreq/amd-pstate: Remove the redundant des_perf clamping in adjust_perf
Posted by Dhananjay Ugwekar 10 months, 1 week ago
des_perf is later on clamped between min_perf and max_perf in
amd_pstate_update. So, remove the redundant clamping from
amd_pstate_adjust_perf.

Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index a23fb78a442b..2926f292be7b 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -703,8 +703,6 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
 	if (max_perf < min_perf)
 		max_perf = min_perf;
 
-	des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf);
-
 	amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true,
 			policy->governor->flags);
 	cpufreq_cpu_put(policy);
-- 
2.34.1
Re: [PATCH 04/12] cpufreq/amd-pstate: Remove the redundant des_perf clamping in adjust_perf
Posted by Gautham R. Shenoy 10 months, 1 week ago
On Wed, Feb 05, 2025 at 11:25:15AM +0000, Dhananjay Ugwekar wrote:
> des_perf is later on clamped between min_perf and max_perf in
> amd_pstate_update. So, remove the redundant clamping from
> amd_pstate_adjust_perf.
> 
> Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>

Nice catch.

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>

-- 
Thanks and Regards
gautham.
> ---
>  drivers/cpufreq/amd-pstate.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index a23fb78a442b..2926f292be7b 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -703,8 +703,6 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
>  	if (max_perf < min_perf)
>  		max_perf = min_perf;
>  
> -	des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf);
> -
>  	amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true,
>  			policy->governor->flags);
>  	cpufreq_cpu_put(policy);
> -- 
> 2.34.1
>
Re: [PATCH 04/12] cpufreq/amd-pstate: Remove the redundant des_perf clamping in adjust_perf
Posted by Mario Limonciello 10 months, 1 week ago
On 2/5/2025 05:25, Dhananjay Ugwekar wrote:
> des_perf is later on clamped between min_perf and max_perf in
> amd_pstate_update. So, remove the redundant clamping from
> amd_pstate_adjust_perf.
> 
> Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

I'll queue this for 6.15.

> ---
>   drivers/cpufreq/amd-pstate.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index a23fb78a442b..2926f292be7b 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -703,8 +703,6 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
>   	if (max_perf < min_perf)
>   		max_perf = min_perf;
>   
> -	des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf);
> -
>   	amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true,
>   			policy->governor->flags);
>   	cpufreq_cpu_put(policy);