File 19492-sched-timer-non-idle.patch of Package xen
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1238596760 -3600
# Node ID e89f7c2b9e0d695645f86816da5fd05b340fa36e
# Parent 4da7f15e91262866bc6b0cdfee8883f4d2810955
Only set scheduler quantum timer for non-idle VCPUs
This removes the last idle periodic timer in xen, and enhances the
idle average C state residency from two-digits ms to three-digit ms.
Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Tian Kevin <kevin.tian@intel.com>
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1238678239 -3600
# Node ID 5a60eb7fad79294ca1b9e74f8da1ea1d165d3199
# Parent 085d22289e1b078f6bee808eb14209ca91c58451
Move logic for avoiding limited idle quantum into credit scheduler.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -741,7 +741,6 @@ static void schedule(void)
s_time_t now = NOW();
struct schedule_data *sd;
struct task_slice next_slice;
- s32 r_time; /* time for new dom to run */
ASSERT(!in_irq());
ASSERT(this_cpu(mc_state).flags == 0);
@@ -757,12 +756,12 @@ static void schedule(void)
/* get policy-specific decision on scheduling... */
next_slice = ops.do_schedule(now);
- r_time = next_slice.time;
next = next_slice.task;
sd->curr = next;
-
- set_timer(&sd->s_timer, now + r_time);
+
+ if ( next_slice.time >= 0 ) /* -ve means no limit */
+ set_timer(&sd->s_timer, now + next_slice.time);
if ( unlikely(prev == next) )
{
@@ -777,7 +776,7 @@ static void schedule(void)
next->domain->domain_id,
(next->runstate.state == RUNSTATE_runnable) ?
(now - next->runstate.state_entry_time) : 0,
- r_time);
+ next_slice.time);
ASSERT(prev->runstate.state == RUNSTATE_running);
vcpu_runstate_change(
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -1230,7 +1230,8 @@ csched_schedule(s_time_t now)
/*
* Return task to run next...
*/
- ret.time = MILLISECS(CSCHED_MSECS_PER_TSLICE);
+ ret.time = (is_idle_vcpu(snext->vcpu) ?
+ -1 : MILLISECS(CSCHED_MSECS_PER_TSLICE));
ret.task = snext->vcpu;
CSCHED_VCPU_CHECK(ret.task);