[libvirt] [PATCH RESEND RFC v4 5/6] qemu: Implement cfs_period and cfs_quota's modification

Wen Congyang wency at cn.fujitsu.com
Fri Jul 22 02:35:23 UTC 2011


At 07/21/2011 09:00 PM, Adam Litke Write:
> 
> 
> On 07/20/2011 09:11 PM, Wen Congyang wrote:
>> +static int
>> +qemuGetVcpusBWLive(virDomainObjPtr vm, virCgroupPtr cgroup,
>> +                   unsigned long long *period, long long *quota)
>> +{
>> +    virCgroupPtr cgroup_vcpu = NULL;
>> +    qemuDomainObjPrivatePtr priv = NULL;
>> +    int rc;
>> +    int ret = -1;
>> +
>> +    priv = vm->privateData;
>> +    if (priv->nvcpupids == 0 || priv->vcpupids[0] == vm->pid) {
>> +        /* We do not create sub dir for each vcpu */
>> +        rc = qemuGetVcpuBWLive(cgroup, period, quota);
>> +        if (rc < 0)
>> +            goto cleanup;
>> +
>> +        if (*quota > 0)
>> +            *quota /= vm->def->vcpus;
>> +        goto out;
>> +    }
> 
> Are you sure the above is correct?  Based on my earlier suggestion,
> <quota> is always specified as the amount of runtime afforded to a
> single vcpu.  Hence, if you are changing quota to cover for all of a
> vm's vcpus, wouldn't you want to:
> 
>           *quota *= vm->def->vcpus;

When we set, we use '*quota *= vm->def->vcpus;',
so when we read, we should use '*quota /= vm->def->vcpus'

Thanks
Wen Congyang

> ?
> 




More information about the libvir-list mailing list