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

Re: [Xen-devel] [PATCH v7 for Xen 4.7 1/4] xen: enable per-VCPU parameter settings for RTDS scheduler



>>> On 17.03.16 at 11:03, <dario.faggioli@xxxxxxxxxx> wrote:
> On Wed, 2016-03-16 at 11:47 -0500, Chong Li wrote:
>> --- a/xen/common/sched_credit.c
>> +++ b/xen/common/sched_credit.c
>> @@ -1054,15 +1054,16 @@ csched_dom_cntl(
>>       * lock. Runq lock not needed anywhere in here. */
>>      spin_lock_irqsave(&prv->lock, flags);
>>  
>> -    if ( op->cmd == XEN_DOMCTL_SCHEDOP_getinfo )
>> +    switch ( op->cmd )
>>      {
>> +    case XEN_DOMCTL_SCHEDOP_putvcpuinfo:
>> +    case XEN_DOMCTL_SCHEDOP_getvcpuinfo:
>> +        return -EINVAL;
>> +    case XEN_DOMCTL_SCHEDOP_getinfo:
>>          op->u.credit.weight = sdom->weight;
>>          op->u.credit.cap = sdom->cap;
>>
> Not feeling to strong about it, but I think
> 
>     switch ( op->cmd )
>     {
>     case XEN_DOMCTL_SCHEDOP_getinfo:
>         op->u.credit.weight = sdom->weight;
>         op->u.credit.cap = sdom->cap;
>         break;
>     case XEN_DOMCTL_SCHEDOP_putinfo:
>         if ( op->u.credit.weight != 0 )
>         {
>             if ( !list_empty(&sdom->active_sdom_elem) )
>             {
>                 prv->weight -= sdom->weight * sdom->active_vcpu_count;
>                 prv->weight += op->u.credit.weight * sdom->active_vcpu_count;
>             }
>             sdom->weight = op->u.credit.weight;
>         }
> 
>         if ( op->u.credit.cap != (uint16_t)~0U )
>             sdom->cap = op->u.credit.cap;
>         break;
>     case XEN_DOMCTL_SCHEDOP_putvcpuinfo:
>     case XEN_DOMCTL_SCHEDOP_getvcpuinfo:
>     default:
>         return -EINVAL;
>     }
> 
> (i.e., grouping the cases that needs only returning -EINVAL) is better,
> the final result, more than the patch itself.

In fact there's no point in explicitly naming the unhandled values
as long as they're matching what "default:" does.

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®.