This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


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

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] cpuidle: Add decaying history logic to menu idle predictor
From: "Yu, Ke" <ke.yu@xxxxxxxxx>
Date: Wed, 25 Nov 2009 16:59:33 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: "'xen-devel@xxxxxxxxxxxxxxxxxxx'" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 25 Nov 2009 01:00:34 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcptrZskT3DAhgLNQXicPKqxKIYEKw==
Thread-topic: [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 

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

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 
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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] cpuidle: Add decaying history logic to menu idle predictor, Yu, Ke <=