examples/vm_power: allow managing idle cores

This change is required to allow the branch ratio algorithm to
power manage cores with no workload running on them. This is
useful both when idle cores don't use C-states and for a number of
hyperthreading scenarios.

Signed-off-by: Rory Sexton <rory.sexton@intel.com>
Reviewed-by: David Hunt <david.hunt@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
This commit is contained in:
Rory Sexton 2020-07-14 17:01:59 +01:00 committed by Thomas Monjalon
parent 95f648ff9e
commit 3cb46d40d3
2 changed files with 6 additions and 4 deletions

View File

@ -423,6 +423,8 @@ described below:
0.01 but will need adjustment for different workloads
This parameter can be used multiple times for different sets of cores.
The branch ratio mechanism can also be useful for non-PMD cores and
hyper-threaded environments where C-States are disabled.
Compiling and Running the Guest Applications

View File

@ -96,12 +96,12 @@ apply_policy(int core)
g_branch_misses = miss_diff;
if (hits_diff < (INTERVAL*100)) {
/* Likely no workload running on this core. Skip. */
return -1.0;
/* Likely no workload running on this core. */
ratio = 0.0;
} else {
ratio = (float)miss_diff * (float)100 / (float)hits_diff;
}
ratio = (float)miss_diff * (float)100 / (float)hits_diff;
/*
* Store the last few directions that the ratio indicates
* we should take. If there's on 'up', then we scale up