Skip to content

Commit 602a1cb

Browse files
rafaeljwgregkh
authored andcommitted
ACPI: processor: perflib: Avoid updating frequency QoS unnecessarily
commit 99387b0 upstream. 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: Rafael J. Wysocki <[email protected]> Tested-by: Hagar Hemdan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f7fcc0f commit 602a1cb

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

drivers/acpi/processor_perflib.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,16 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
7676

7777
index = ppc;
7878

79+
if (pr->performance_platform_limit == index ||
80+
ppc >= pr->performance->state_count)
81+
return 0;
82+
7983
pr_debug("CPU %d: _PPC is %d - frequency %s limited\n", pr->id,
8084
index, index ? "is" : "is not");
8185

8286
pr->performance_platform_limit = index;
8387

84-
if (ppc >= pr->performance->state_count ||
85-
unlikely(!freq_qos_request_active(&pr->perflib_req)))
88+
if (unlikely(!freq_qos_request_active(&pr->perflib_req)))
8689
return 0;
8790

8891
/*
@@ -177,9 +180,16 @@ void acpi_processor_ppc_init(struct cpufreq_policy *policy)
177180
if (!pr)
178181
continue;
179182

183+
/*
184+
* Reset performance_platform_limit in case there is a stale
185+
* value in it, so as to make it match the "no limit" QoS value
186+
* below.
187+
*/
188+
pr->performance_platform_limit = 0;
189+
180190
ret = freq_qos_add_request(&policy->constraints,
181-
&pr->perflib_req,
182-
FREQ_QOS_MAX, INT_MAX);
191+
&pr->perflib_req, FREQ_QOS_MAX,
192+
FREQ_QOS_MAX_DEFAULT_VALUE);
183193
if (ret < 0)
184194
pr_err("Failed to add freq constraint for CPU%d (%d)\n",
185195
cpu, ret);

0 commit comments

Comments
 (0)