diff options
author | 2025-05-06 22:47:53 +0200 | |
---|---|---|
committer | 2025-05-13 14:35:25 +0200 | |
commit | 05cf8b8c5118479637efe281e5eb98972d3a3386 (patch) | |
tree | 4236da72f6706dcee3ad159017859d0f39ca89a0 /drivers/cpufreq | |
parent | cpufreq: intel_pstate: EAS support for hybrid platforms (diff) | |
download | linux-rng-05cf8b8c5118479637efe281e5eb98972d3a3386.tar.xz linux-rng-05cf8b8c5118479637efe281e5eb98972d3a3386.zip |
cpufreq: intel_pstate: EAS: Increase cost for CPUs using L3 cache
On some hybrid platforms some efficient CPUs (E-cores) are not connected
to the L3 cache, but there are no other differences between them and the
other E-cores that use L3. In that case, it is generally more efficient
to run "light" workloads on the E-cores that do not use L3 and allow all
of the cores using L3, including P-cores, to go into idle states.
For this reason, slightly increase the cost for all CPUs sharing the L3
cache to make EAS prefer CPUs that do not use it to the other CPUs of
the same type (if any).
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/2032776.usQuhbGJ8B@rjwysocki.net
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/intel_pstate.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index b46fc7054831..0102c3e1441f 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -982,6 +982,7 @@ static int hybrid_get_cost(struct device *dev, unsigned long freq, unsigned long *cost) { struct pstate_data *pstate = &all_cpu_data[dev->id]->pstate; + struct cpu_cacheinfo *cacheinfo = get_cpu_cacheinfo(dev->id); /* * The smaller the perf-to-frequency scaling factor, the larger the IPC @@ -994,6 +995,22 @@ static int hybrid_get_cost(struct device *dev, unsigned long freq, * of the same type in different "utilization bins" is different. */ *cost = div_u64(100ULL * INTEL_PSTATE_CORE_SCALING, pstate->scaling) + freq; + /* + * Increase the cost slightly for CPUs able to access L3 to avoid + * touching it in case some other CPUs of the same type can do the work + * without it. + */ + if (cacheinfo) { + unsigned int i; + + /* Check if L3 cache is there. */ + for (i = 0; i < cacheinfo->num_leaves; i++) { + if (cacheinfo->info_list[i].level == 3) { + *cost += 2; + break; + } + } + } return 0; } |