|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] xen: sched: don't call hooks of the wrong scheduler via VCPU2OP
>>> On 16.03.17 at 22:30, <dario.faggioli@xxxxxxxxxx> wrote:
> --- a/xen/common/schedule.c
> +++ b/xen/common/schedule.c
> @@ -78,7 +78,19 @@ static struct scheduler __read_mostly ops;
> : (typeof((opsptr)->fn(opsptr, ##__VA_ARGS__)))0 )
>
> #define DOM2OP(_d) (((_d)->cpupool == NULL) ? &ops :
> ((_d)->cpupool->sched))
> -#define VCPU2OP(_v) (DOM2OP((_v)->domain))
> +static inline struct scheduler* VCPU2OP(const struct vcpu *v)
The * and blank in the return type want to switch positions.
> +{
> + struct domain *d = v->domain;
> +
> + if ( likely(d->cpupool != NULL) )
> + return d->cpupool->sched;
> +
> + /* v->processor never changes for idle vcpus, so using it here is safe */
> + if ( likely(is_idle_domain(d)) )
> + return per_cpu(scheduler, v->processor);
> + else
> + return &ops;
Having read through the description, I don't think I can conclude
why using &ops here is correct (or at least benign). And even if
this was explained in the description, I think a brief comment
would be rather desirable here (the more that it having been
&ops implicitly was wrong before as per the description).
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |