[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 2/2] xen: credit1: avoid boosting vCPUs being "just" migrated



>>> On 12.02.16 at 10:37, <dario.faggioli@xxxxxxxxxx> wrote:
> @@ -787,6 +788,16 @@ _csched_cpu_pick(const struct scheduler *ops, struct 
> vcpu *vc, bool_t commit)
>  static int
>  csched_cpu_pick(const struct scheduler *ops, struct vcpu *vc)
>  {
> +    struct csched_vcpu *svc = CSCHED_VCPU(vc);
> +
> +    /*
> +     * We have been called by vcpu_migrate() (in schedule.c), as part
> +     * of the process of seeing if vc can be migrated to another pcpu.
> +     * We make a note about this in svc->flags so that later, in
> +     * csched_vcpu_wake() (still called from vcpu_migrate()) we won't
> +     * get boosted, which we don't deserve as we are "only" migrating.
> +     */
> +    set_bit(CSCHED_FLAG_VCPU_MIGRATING, &svc->flags);
>      return _csched_cpu_pick(ops, vc, 1);
>  }

I think you either want __set_bit() here or ...

> @@ -1022,11 +1033,18 @@ csched_vcpu_wake(const struct scheduler *ops, struct 
> vcpu *vc)
>       * more CPU resource intensive VCPUs without impacting overall 
>       * system fairness.
>       *
> -     * The one exception is for VCPUs of capped domains unpausing
> -     * after earning credits they had overspent. We don't boost
> -     * those.
> +     * There are two cases, when we don't want to boost:
> +     *  - VCPUs that are waking up after a migration, rather than
> +     *    after having block;
> +     *  - VCPUs of capped domains unpausing after earning credits
> +     *    they had overspent.
> +     *
> +     * Note that checking whether we are "only" migrating must be
> +     * done up front, as we do not want the clearing of the bit we
> +     * set in csched_cpu_pick() to be short-circuited away.
>       */
> -    if ( svc->pri == CSCHED_PRI_TS_UNDER &&
> +    if ( !__test_and_clear_bit(CSCHED_FLAG_VCPU_MIGRATING, &svc->flags)  &&
> +         svc->pri == CSCHED_PRI_TS_UNDER &&
>           !test_bit(CSCHED_FLAG_VCPU_PARKED, &svc->flags) )
>      {

... you ought to use test_and_clear_bit() here.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.