[v2,2/3] examples/vm_power_manager: Allowing power managing of idle cores
diff mbox series

Message ID 20200518103902.27927-2-rory.sexton@intel.com
State New
Delegated to: Thomas Monjalon
Headers show
Series
  • [v2,1/3] examples/vm_power_manager: Make branch ratio threshold per core
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch warning coding style issues

Commit Message

Sexton, Rory May 18, 2020, 10:39 a.m. UTC
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>
---
 examples/vm_power_manager/oob_monitor_x86.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Hunt, David June 25, 2020, 10:17 a.m. UTC | #1
Hi Rory,

On 18/5/2020 11:39 AM, Sexton, Rory wrote:
> 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>
> ---
>   examples/vm_power_manager/oob_monitor_x86.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/examples/vm_power_manager/oob_monitor_x86.c b/examples/vm_power_manager/oob_monitor_x86.c
> index 3c514475f..a5b1c168c 100644
> --- a/examples/vm_power_manager/oob_monitor_x86.c
> +++ b/examples/vm_power_manager/oob_monitor_x86.c
> @@ -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


Good enhancement. It hadn't occurred to me to manage non-PMD workloads, 
but I agree that when
C-States are disabled on a system, there may be cases where this 
algorithm is useful to save power.

Reviewed-by: David Hunt <david.hunt@intel.com>

Patch
diff mbox series

diff --git a/examples/vm_power_manager/oob_monitor_x86.c b/examples/vm_power_manager/oob_monitor_x86.c
index 3c514475f..a5b1c168c 100644
--- a/examples/vm_power_manager/oob_monitor_x86.c
+++ b/examples/vm_power_manager/oob_monitor_x86.c
@@ -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