Commit 45722e77 authored by Mario Limonciello's avatar Mario Limonciello

cpufreq: amd-pstate: Optimize amd_pstate_update_limits()

Don't take and release the mutex when prefcore isn't present and
avoid initialization of variables that will be initially set
in the function.
Reviewed-by: default avatarGautham R. Shenoy <gautham.shenoy@amd.com>
Reviewed-by: default avatarPerry Yuan <perry.yuan@amd.com>
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
parent ad4caad5
...@@ -810,17 +810,17 @@ static void amd_pstate_update_limits(unsigned int cpu) ...@@ -810,17 +810,17 @@ static void amd_pstate_update_limits(unsigned int cpu)
cpudata = policy->driver_data; cpudata = policy->driver_data;
mutex_lock(&amd_pstate_driver_lock); if (!amd_pstate_prefcore)
if ((!amd_pstate_prefcore) || (!cpudata->hw_prefcore)) return;
goto free_cpufreq_put;
mutex_lock(&amd_pstate_driver_lock);
ret = amd_get_highest_perf(cpu, &cur_high); ret = amd_get_highest_perf(cpu, &cur_high);
if (ret) if (ret)
goto free_cpufreq_put; goto free_cpufreq_put;
prev_high = READ_ONCE(cpudata->prefcore_ranking); prev_high = READ_ONCE(cpudata->prefcore_ranking);
if (prev_high != cur_high) { highest_perf_changed = (prev_high != cur_high);
highest_perf_changed = true; if (highest_perf_changed) {
WRITE_ONCE(cpudata->prefcore_ranking, cur_high); WRITE_ONCE(cpudata->prefcore_ranking, cur_high);
if (cur_high < CPPC_MAX_PERF) if (cur_high < CPPC_MAX_PERF)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment