[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 33/47] xen/sched: add a percpu resource index
On 14.09.2019 10:52, Juergen Gross wrote: > --- a/xen/common/schedule.c > +++ b/xen/common/schedule.c > @@ -71,6 +71,7 @@ static void poll_timer_fn(void *data); > /* This is global for now so that private implementations can reach it */ > DEFINE_PER_CPU(struct scheduler *, scheduler); > DEFINE_PER_CPU_READ_MOSTLY(struct sched_resource *, sched_res); > +static DEFINE_PER_CPU_READ_MOSTLY(unsigned int, sched_res_idx); It's of course not very helpful that this variable (right here) doesn't ever get written to, and hence one can't judge where / how this is to be done (without going look elsewhere). But I guess that calculation can't be moved into this patch (accepting that it would always yield zero for now)? > @@ -135,6 +136,12 @@ static struct scheduler sched_idle_ops = { > .switch_sched = sched_idle_switch_sched, > }; > > +static inline struct vcpu *sched_unit2vcpu_cpu(struct sched_unit *unit, const (on the parameter)? > + unsigned int cpu) > +{ > + return unit->domain->vcpu[unit->unit_id + per_cpu(sched_res_idx, cpu)]; > +} > + > static inline struct scheduler *dom_scheduler(const struct domain *d) > { > if ( likely(d->cpupool != NULL) ) > @@ -2008,7 +2015,7 @@ static void sched_slave(void) > > pcpu_schedule_unlock_irq(lock, cpu); > > - sched_context_switch(vprev, next->vcpu_list, now); > + sched_context_switch(vprev, sched_unit2vcpu_cpu(next, cpu), now); > } By the end of the series this will be sched_context_switch(vprev, sched_unit2vcpu_cpu(next, cpu), is_idle_unit(next) && !is_idle_unit(prev), now); clarifying (I think) that "next" can indeed be an idle unit. I'm having difficulty seeing how can produce the correct result in all three cases - all vCPU-s in the unit belong to a real domain - all vCPU-s in the unit belong to the idle domain - there's a mix of "real" and (filler) "idle" vCPU-s My main question is what "next" is in the last of the 3 cases above. Considering that scheduling happens in terms of units, I'd expect it to be a real domain's unit, yet then I don't see how you'd get at the correct (idle) vCPU when calling sched_unit2vcpu_cpu(next, cpu). Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |