MEDIUM: cpu-topo: change "efficiency" to consider per-core capacity
This is similar to the previous change to the "performance" policy but it applies to the "efficiency" one. Here we're changing the sorting method to sort CPU clusters by average per-CPU capacity, and we evict clusters whose per-CPU capacity is above 125% of the previous one. Per-core capacity allows to detect discrepancies between CPU cores, and to continue to focus on efficient ones as a priority.
This commit is contained in:
parent
6c88e27cf4
commit
70b0dd6b0f
@ -1993,16 +1993,17 @@ cpu-policy <policy>
|
|||||||
if not set, will be set to 1.
|
if not set, will be set to 1.
|
||||||
|
|
||||||
- efficiency exactly like group-by-cluster below, except that CPU
|
- efficiency exactly like group-by-cluster below, except that CPU
|
||||||
clusters whose performance is more than twice that of
|
clusters composed of cores whose performance is more
|
||||||
the next less performant one are evicted. These are
|
than 25% above that of the next less performant one are
|
||||||
typically "big" or "performance" cores. This means that
|
evicted. These are typically "big" or "performance"
|
||||||
if more than one type of CPU cores are detected, only
|
cores. This means that if more than one type of CPU
|
||||||
the efficient one will be used. This can make sense for
|
cores are detected, only the efficient one will be
|
||||||
use with moderate loads when the most powerful cores
|
used. This can make sense for use with moderate loads
|
||||||
need to be available to the application or a security
|
when the most powerful cores need to be available to
|
||||||
component. Some modern CPUs have a large number of such
|
the application or a security component. Some modern
|
||||||
efficient CPU cores which can collectively deliver a
|
CPUs have a large number of such efficient CPU cores
|
||||||
decent level of performance while using less power.
|
which can collectively deliver a decent level of
|
||||||
|
performance while using less power.
|
||||||
|
|
||||||
- first-usable-node if the CPUs were not previously restricted at boot (for
|
- first-usable-node if the CPUs were not previously restricted at boot (for
|
||||||
example using the "taskset" utility), and if the
|
example using the "taskset" utility), and if the
|
||||||
|
@ -1359,7 +1359,7 @@ static int cpu_policy_performance(int policy, int tmin, int tmax, int gmin, int
|
|||||||
|
|
||||||
/* the "efficiency" cpu-policy:
|
/* the "efficiency" cpu-policy:
|
||||||
* - does nothing if nbthread or thread-groups are set
|
* - does nothing if nbthread or thread-groups are set
|
||||||
* - eliminates clusters whose total capacity is above half of others
|
* - eliminates clusters whose average per-cpu capacity is above 80% of others
|
||||||
* - tries to create one thread-group per cluster, with as many
|
* - tries to create one thread-group per cluster, with as many
|
||||||
* threads as CPUs in the cluster, and bind all the threads of
|
* threads as CPUs in the cluster, and bind all the threads of
|
||||||
* this group to all the CPUs of the cluster.
|
* this group to all the CPUs of the cluster.
|
||||||
@ -1372,22 +1372,25 @@ static int cpu_policy_efficiency(int policy, int tmin, int tmax, int gmin, int g
|
|||||||
if (global.nbthread || global.nbtgroups)
|
if (global.nbthread || global.nbtgroups)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* sort clusters by reverse capacity */
|
/* sort clusters by average reverse capacity */
|
||||||
cpu_cluster_reorder_by_capa(ha_cpu_clusters, cpu_topo_maxcpus);
|
cpu_cluster_reorder_by_avg_capa(ha_cpu_clusters, cpu_topo_maxcpus);
|
||||||
|
|
||||||
capa = 0;
|
capa = 0;
|
||||||
for (cluster = cpu_topo_maxcpus - 1; cluster >= 0; cluster--) {
|
for (cluster = cpu_topo_maxcpus - 1; cluster >= 0; cluster--) {
|
||||||
if (capa && ha_cpu_clusters[cluster].capa > capa * 2) {
|
if (capa && ha_cpu_clusters[cluster].capa * 8 >= ha_cpu_clusters[cluster].nb_cpu * capa * 10) {
|
||||||
/* This cluster is more than twice as fast as the
|
/* This cluster is made of cores each at last 25% faster
|
||||||
* previous one, we're not interested in using it.
|
* than those of the previous cluster, previous one, we're
|
||||||
|
* not interested in using it.
|
||||||
*/
|
*/
|
||||||
for (cpu = 0; cpu <= cpu_topo_lastcpu; cpu++) {
|
for (cpu = 0; cpu <= cpu_topo_lastcpu; cpu++) {
|
||||||
if (ha_cpu_topo[cpu].cl_gid == ha_cpu_clusters[cluster].idx)
|
if (ha_cpu_topo[cpu].cl_gid == ha_cpu_clusters[cluster].idx)
|
||||||
ha_cpu_topo[cpu].st |= HA_CPU_F_IGNORED;
|
ha_cpu_topo[cpu].st |= HA_CPU_F_IGNORED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (ha_cpu_clusters[cluster].nb_cpu)
|
||||||
|
capa = ha_cpu_clusters[cluster].capa / ha_cpu_clusters[cluster].nb_cpu;
|
||||||
else
|
else
|
||||||
capa = ha_cpu_clusters[cluster].capa;
|
capa = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu_cluster_reorder_by_index(ha_cpu_clusters, cpu_topo_maxcpus);
|
cpu_cluster_reorder_by_index(ha_cpu_clusters, cpu_topo_maxcpus);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user