cpumask_andnot(&mask, &rqd->idle, &rqd->tickled);
/* If it's not empty, choose one */
- if ( !cpumask_empty(&mask) )
+ i = cpumask_cycle(cpu, &mask);
+ if ( i < nr_cpu_ids )
{
- ipid = cpumask_first(&mask);
+ ipid = i;
goto tickle;
}
else
{
d2printk("d%dv%d +\n", svc->vcpu->domain->domain_id, svc->vcpu->vcpu_id);
- new_cpu = cpumask_first(&svc->migrate_rqd->active);
+ new_cpu = cpumask_cycle(vc->processor, &svc->migrate_rqd->active);
goto out_up;
}
}
new_cpu = vc->processor;
else
{
- BUG_ON(cpumask_empty(&prv->rqd[min_rqi].active));
- new_cpu = cpumask_first(&prv->rqd[min_rqi].active);
+ new_cpu = cpumask_cycle(vc->processor, &prv->rqd[min_rqi].active);
+ BUG_ON(new_cpu >= nr_cpu_ids);
}
out_up:
on_runq=1;
}
__runq_deassign(svc);
- svc->vcpu->processor = cpumask_first(&trqd->active);
+ svc->vcpu->processor = cpumask_any(&trqd->active);
__runq_assign(svc, trqd);
if ( on_runq )
{
load_max = st.orqd->b_avgload;
cpus_max = cpumask_weight(&st.lrqd->active);
- if ( cpumask_weight(&st.orqd->active) > cpus_max )
- cpus_max = cpumask_weight(&st.orqd->active);
+ i = cpumask_weight(&st.orqd->active);
+ if ( i > cpus_max )
+ cpus_max = i;
/* If we're under 100% capacaty, only shift if load difference
* is > 1. otherwise, shift if under 12.5% */