[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] cpuidle: Add decaying history logic to menu idle predictor



cpuidle: Add decaying history logic to menu idle predictor

this patch is ported from linux upstream git commit 
816bb611e41be29b476dc16f6297eb551bf4d747

the original description is:
"
Add decaying history of predicted idle time, instead of using the last early
wakeup. This logic helps menu governor do better job of predicting idle time.

With this change, we also measured noticable (~8%) power savings on
a DP server system with CPUs supporting deep C states, when system
was lightly loaded. There was no change to power or perf on other load
conditions.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@xxxxxxxxx>
Signed-off-by: Len Brown <len.brown@xxxxxxxxx>
"

In Xen environment, we also observe this patch reduce the idle power 
fluctuation.
In one DP server, when system is purely idle, the watts stdev/average reduce
from 6% to 2%. it is helpful for idle power measurement accuracy.
There is no performance and power change when system is loaded.

Signed-off-by: Yu Ke <ke.yu@xxxxxxxxx>

diff -r d44371e6e5d6 xen/arch/x86/acpi/cpuidle_menu.c
--- a/xen/arch/x86/acpi/cpuidle_menu.c
+++ b/xen/arch/x86/acpi/cpuidle_menu.c
@@ -32,6 +32,7 @@
 #include <xen/cpuidle.h>
 
 #define BREAK_FUZZ      4       /* 4 us */
+#define PRED_HISTORY_PCT   50
 #define USEC_PER_SEC 1000000
 
 struct menu_device
@@ -39,6 +40,7 @@ struct menu_device
     int             last_state_idx;
     unsigned int    expected_us;
     unsigned int    predicted_us;
+    unsigned int    current_predicted_us;
     unsigned int    last_measured_us;
     unsigned int    elapsed_us;
 };
@@ -63,6 +65,12 @@ static int menu_select(struct acpi_proce
 
     /* determine the expected residency time */
     data->expected_us = get_sleep_length_us();
+
+    /* Recalculate predicted_us based on prediction_history_pct */
+    data->predicted_us *= PRED_HISTORY_PCT;
+    data->predicted_us += (100 - PRED_HISTORY_PCT) *
+        data->current_predicted_us;
+    data->predicted_us /= 100;
 
     /* find the deepest idle state that satisfies our constraints */
     for ( i = 2; i < power->count; i++ )
@@ -94,7 +102,7 @@ static void menu_reflect(struct acpi_pro
     measured_us = data->elapsed_us <= measured_us ? measured_us : -1;
 
     /* Predict time remaining until next break event */
-    data->predicted_us = max(measured_us, data->last_measured_us);
+    data->current_predicted_us = max(measured_us, data->last_measured_us);
 
     /* Distinguish between expected & non-expected events */
     if ( last_residency + BREAK_FUZZ

Attachment: menu-gov-predict-v2.patch
Description: menu-gov-predict-v2.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.