mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
cpufreq: intel_pstate: Adjust frequency percentage computations
Adjust frequency percentage computations in update_cpu_qos_request() to avoid going above the exact numerical percentage in the FREQ_QOS_MAX case. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Zihuan Zhang <zhangzihuan@kylinos.cn> Link: https://patch.msgid.link/3395556.44csPzL39Z@rafael.j.wysocki [ rjw: Rename "cpu" to "cpudata" and "cpunum" to "cpu" ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
f1bbf5bbf2
commit
ae1bdd23b9
|
|
@ -1655,8 +1655,8 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b,
|
||||||
static void update_cpu_qos_request(int cpu, enum freq_qos_req_type type)
|
static void update_cpu_qos_request(int cpu, enum freq_qos_req_type type)
|
||||||
{
|
{
|
||||||
struct cpudata *cpudata = all_cpu_data[cpu];
|
struct cpudata *cpudata = all_cpu_data[cpu];
|
||||||
|
unsigned int freq = cpudata->pstate.turbo_freq;
|
||||||
struct freq_qos_request *req;
|
struct freq_qos_request *req;
|
||||||
unsigned int freq, perf_pct;
|
|
||||||
|
|
||||||
struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);
|
struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);
|
||||||
if (!policy)
|
if (!policy)
|
||||||
|
|
@ -1670,14 +1670,12 @@ static void update_cpu_qos_request(int cpu, enum freq_qos_req_type type)
|
||||||
intel_pstate_get_hwp_cap(cpudata);
|
intel_pstate_get_hwp_cap(cpudata);
|
||||||
|
|
||||||
if (type == FREQ_QOS_MIN) {
|
if (type == FREQ_QOS_MIN) {
|
||||||
perf_pct = global.min_perf_pct;
|
freq = DIV_ROUND_UP(freq * global.min_perf_pct, 100);
|
||||||
} else {
|
} else {
|
||||||
req++;
|
req++;
|
||||||
perf_pct = global.max_perf_pct;
|
freq = (freq * global.max_perf_pct) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
freq = DIV_ROUND_UP(cpudata->pstate.turbo_freq * perf_pct, 100);
|
|
||||||
|
|
||||||
if (freq_qos_update_request(req, freq) < 0)
|
if (freq_qos_update_request(req, freq) < 0)
|
||||||
pr_warn("Failed to update freq constraint: CPU%d\n", cpu);
|
pr_warn("Failed to update freq constraint: CPU%d\n", cpu);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user