Skip to content

Commit 05cf8b8

Browse files
committed
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 <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 7b010f9 commit 05cf8b8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/cpufreq/intel_pstate.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,7 @@ static int hybrid_get_cost(struct device *dev, unsigned long freq,
982982
unsigned long *cost)
983983
{
984984
struct pstate_data *pstate = &all_cpu_data[dev->id]->pstate;
985+
struct cpu_cacheinfo *cacheinfo = get_cpu_cacheinfo(dev->id);
985986

986987
/*
987988
* 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,
994995
* of the same type in different "utilization bins" is different.
995996
*/
996997
*cost = div_u64(100ULL * INTEL_PSTATE_CORE_SCALING, pstate->scaling) + freq;
998+
/*
999+
* Increase the cost slightly for CPUs able to access L3 to avoid
1000+
* touching it in case some other CPUs of the same type can do the work
1001+
* without it.
1002+
*/
1003+
if (cacheinfo) {
1004+
unsigned int i;
1005+
1006+
/* Check if L3 cache is there. */
1007+
for (i = 0; i < cacheinfo->num_leaves; i++) {
1008+
if (cacheinfo->info_list[i].level == 3) {
1009+
*cost += 2;
1010+
break;
1011+
}
1012+
}
1013+
}
9971014

9981015
return 0;
9991016
}

0 commit comments

Comments
 (0)