Re: [PATCH V6 5/7] cpufreq: amd-pstate: Update amd-pstate preferred core ranking dynamically

From: Peter Zijlstra
Date: Sat Sep 09 2023 - 13:59:27 EST


On Fri, Sep 08, 2023 at 03:46:51PM +0800, Meng Li wrote:
> +static void amd_pstate_update_highest_perf(unsigned int cpu)
> +{
> + struct cpufreq_policy *policy;
> + struct amd_cpudata *cpudata;
> + u32 prev_high = 0, cur_high = 0;
> + u64 highest_perf;
> + int ret;
> +
> + if (!prefcore)
> + return;
> +
> + ret = amd_pstate_get_highest_perf(cpu, &highest_perf);
> + if (ret)
> + return;
> +
> + policy = cpufreq_cpu_get(cpu);
> + cpudata = policy->driver_data;
> + cur_high = highest_perf;
> + prev_high = READ_ONCE(cpudata->prefcore_ranking);
> +
> + if (prev_high != cur_high) {
> + WRITE_ONCE(cpudata->prefcore_ranking, cur_high);
> + sched_set_itmt_core_prio(cur_high, cpu);
> + }
> +
> + cpufreq_cpu_put(policy);
> +}

Idem -- I told to clarify the u32 vs int thing, nothing here.