WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 1/2] Add a small scheduler knob "sched_smt_power_savi

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 1/2] Add a small scheduler knob "sched_smt_power_savings"
From: "Yu, Ke" <ke.yu@xxxxxxxxx>
Date: Fri, 20 Mar 2009 14:41:34 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: "Tian, Kevin" <kevin.tian@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 19 Mar 2009 23:44:42 -0700
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: AcmpJuMF88JM8BWNQiy6yCb0X8bQuQ==
Thread-topic: [PATCH 1/2] Add a small scheduler knob "sched_smt_power_savings"
Add a small scheduler knob "sched_smt_power_savings"

Current scheduler only care performance, thus always picks pCPU from the most 
idle package. This knob provides another option to pick pCPU from least idle 
package, for user who want performance power balance.

Signed-off-by:  Yu Ke <ke.yu@xxxxxxxxx>
                Tian Kevin <kevin.tian@xxxxxxxxx>

diff -r 0e1449d6f231 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -387,7 +387,7 @@ csched_cpu_pick(struct vcpu *vc)
     {
         cpumask_t cpu_idlers;
         cpumask_t nxt_idlers;
-        int nxt;
+        int nxt, weight_cpu, weight_nxt;
 
         nxt = cycle_cpu(cpu, cpus);
 
@@ -404,7 +404,10 @@ csched_cpu_pick(struct vcpu *vc)
             cpus_and(nxt_idlers, idlers, cpu_core_map[nxt]);
         }
 
-        if ( cpus_weight(cpu_idlers) < cpus_weight(nxt_idlers) )
+        weight_cpu = cpus_weight(cpu_idlers);
+        weight_nxt = cpus_weight(nxt_idlers);
+        if ( ( (weight_cpu < weight_nxt) ^ sched_smt_power_savings )
+                && (weight_cpu != weight_nxt) )
         {
             cpu = nxt;
             cpu_clear(cpu, cpus);
diff -r 0e1449d6f231 xen/common/schedule.c
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -37,6 +37,13 @@
 /* opt_sched: scheduler - default to credit */
 static char opt_sched[10] = "credit";
 string_param("sched", opt_sched);
+
+/* if sched_smt_power_savings is set,
+ * scheduler will give preferrence to partially idle package compared to
+ * the full idle package, when picking pCPU to schedule vCPU.
+ */
+int sched_smt_power_savings = 0;
+boolean_param("sched_smt_power_savings", sched_smt_power_savings);
 
 #define TIME_SLOP      (s32)MICROSECS(50)     /* allow time to slip a bit */
 
@@ -942,6 +949,8 @@ void dump_runq(unsigned char key)
 
     printk("Scheduler: %s (%s)\n", ops.name, ops.opt_name);
     SCHED_OP(dump_settings);
+    printk("sched_smt_power_savings: %s\n",
+            sched_smt_power_savings? "enabled":"disabled");
     printk("NOW=0x%08X%08X\n",  (u32)(now>>32), (u32)now);
 
     for_each_online_cpu ( i )
diff -r 0e1449d6f231 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -550,6 +550,8 @@ uint64_t get_cpu_idle_time(unsigned int 
 #define is_hvm_vcpu(v)   (is_hvm_domain(v->domain))
 #define need_iommu(d)    ((d)->need_iommu && !(d)->is_hvm)
 
+extern int sched_smt_power_savings;
+
 extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen
 } cpufreq_controller;

Attachment: sched_smt_power_savings_1_xen.patch
Description: sched_smt_power_savings_1_xen.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 1/2] Add a small scheduler knob "sched_smt_power_savings", Yu, Ke <=