Commit 99387b01 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

ACPI: processor: perflib: Avoid updating frequency QoS unnecessarily

Modify acpi_processor_get_platform_limit() to avoid updating its
frequency QoS request when the _PPC return value has not changed
by comparing that value to the previous _PPC return value stored in
the performance_platform_limit field of the struct acpi_processor
corresponding to the given CPU.

While at it, do the _PPC return value check against the state count
earlier, to avoid setting performance_platform_limit to an invalid
value, and make acpi_processor_ppc_init() use FREQ_QOS_MAX_DEFAULT_VALUE
as the "no limit" frequency QoS for consistency.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent c02d5feb
...@@ -76,13 +76,16 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) ...@@ -76,13 +76,16 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
index = ppc; index = ppc;
if (pr->performance_platform_limit == index ||
ppc >= pr->performance->state_count)
return 0;
pr_debug("CPU %d: _PPC is %d - frequency %s limited\n", pr->id, pr_debug("CPU %d: _PPC is %d - frequency %s limited\n", pr->id,
index, index ? "is" : "is not"); index, index ? "is" : "is not");
pr->performance_platform_limit = index; pr->performance_platform_limit = index;
if (ppc >= pr->performance->state_count || if (unlikely(!freq_qos_request_active(&pr->perflib_req)))
unlikely(!freq_qos_request_active(&pr->perflib_req)))
return 0; return 0;
/* /*
...@@ -178,9 +181,16 @@ void acpi_processor_ppc_init(struct cpufreq_policy *policy) ...@@ -178,9 +181,16 @@ void acpi_processor_ppc_init(struct cpufreq_policy *policy)
if (!pr) if (!pr)
continue; continue;
/*
* Reset performance_platform_limit in case there is a stale
* value in it, so as to make it match the "no limit" QoS value
* below.
*/
pr->performance_platform_limit = 0;
ret = freq_qos_add_request(&policy->constraints, ret = freq_qos_add_request(&policy->constraints,
&pr->perflib_req, &pr->perflib_req, FREQ_QOS_MAX,
FREQ_QOS_MAX, INT_MAX); FREQ_QOS_MAX_DEFAULT_VALUE);
if (ret < 0) if (ret < 0)
pr_err("Failed to add freq constraint for CPU%d (%d)\n", pr_err("Failed to add freq constraint for CPU%d (%d)\n",
cpu, ret); cpu, ret);
......
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