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;
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
|