# HG changeset patch # Parent 3a70bd1d02c1334857c84c9fb5e1dd22b6603a2c diff -r 3a70bd1d02c1 xen/common/sched_credit.c --- a/xen/common/sched_credit.c Thu Nov 15 18:22:56 2012 +0100 +++ b/xen/common/sched_credit.c Thu Nov 15 19:03:19 2012 +0100 @@ -274,7 +274,7 @@ static inline void } /* - * If this CPU has at least two runnable VCPUs, we tickle any idlers to + * If this CPU has at least two runnable VCPUs, we tickle some idlers to * let them know there is runnable work in the system... */ if ( cur->pri > CSCHED_PRI_IDLE ) @@ -287,7 +287,17 @@ static inline void { cpumask_t idle_mask; - cpumask_and(&idle_mask, prv->idlers, new->vcpu->cpu_affinity); + /* + * Which idlers do we want to tickle? If new has higher priority, + * it will likely preempt cur and run here. We then need someone + * where cur can run to come and pick it up. Vice-versa, if it is + * cur that stays, we poke idlers where new can run. + */ + if ( new->pri > cur->pri ) + cpumask_and(&idle_mask, prv->idlers, cur->vcpu->cpu_affinity); + else + cpumask_and(&idle_mask, prv->idlers, new->vcpu->cpu_affinity); + if ( !cpumask_empty(&idle_mask) ) { SCHED_STAT_CRANK(tickle_idlers_some);