diff --git a/xen/common/sched_sedf.c b/xen/common/sched_sedf.c index 27fac36494..d1812b6c48 100644 --- a/xen/common/sched_sedf.c +++ b/xen/common/sched_sedf.c @@ -397,7 +397,8 @@ static int sedf_pick_cpu(const struct scheduler *ops, struct vcpu *v) online = cpupool_scheduler_cpumask(v->domain->cpupool); cpumask_and(&online_affinity, v->cpu_affinity, online); - return cpumask_first(&online_affinity); + return cpumask_cycle(v->vcpu_id % cpumask_weight(&online_affinity) - 1, + &online_affinity); } /* diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 1fc9b7df6c..de111105c4 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -613,7 +613,8 @@ int vcpu_set_affinity(struct vcpu *v, const cpumask_t *affinity) vcpu_schedule_lock_irq(v); cpumask_copy(v->cpu_affinity, affinity); - if ( !cpumask_test_cpu(v->processor, v->cpu_affinity) ) + if ( VCPU2OP(v)->sched_id == XEN_SCHEDULER_SEDF || + !cpumask_test_cpu(v->processor, v->cpu_affinity) ) set_bit(_VPF_migrating, &v->pause_flags); vcpu_schedule_unlock_irq(v);