examples/vm_power: allow managing idle cores
authorRory Sexton <rory.sexton@intel.com>
Tue, 14 Jul 2020 16:01:59 +0000 (17:01 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 17 Jul 2020 12:40:56 +0000 (14:40 +0200)
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>
doc/guides/sample_app_ug/vm_power_management.rst
examples/vm_power_manager/oob_monitor_x86.c

index 24eb567..1b6de8e 100644 (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.
    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
 
 
 Compiling and Running the Guest Applications
index 3c51447..a5b1c16 100644 (file)
@@ -96,12 +96,12 @@ apply_policy(int core)
        g_branch_misses = miss_diff;
 
        if (hits_diff < (INTERVAL*100)) {
        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
        /*
         * Store the last few directions that the ratio indicates
         * we should take. If there's on 'up', then we scale up