Re: [PATCH 34/34] qemu: cgroup: Don't use priv->ncpupids to iterate domain vCPUs

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

 




On 11/20/2015 10:22 AM, Peter Krempa wrote:
> Use the proper data structures for the iteration since ncpupids will be
> made private later.
> ---
>  src/qemu/qemu_cgroup.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
> index d8a2b03..06c20c1 100644
> --- a/src/qemu/qemu_cgroup.c
> +++ b/src/qemu/qemu_cgroup.c
> @@ -800,7 +800,12 @@ qemuRestoreCgroupState(virDomainObjPtr vm)
>      if (virCgroupSetCpusetMems(priv->cgroup, mem_mask) < 0)
>          goto error;
> 
> -    for (i = 0; i < priv->nvcpupids; i++) {
> +    for (i = 0; i < virDomainDefGetVCpusMax(vm->def); i++) {
> +        virDomainVCpuInfoPtr vcpu = virDomainDefGetVCpu(vm->def, i);
> +

What if !vcpu?  Shouldn't happen, but not checked - trying to consider
future too.

> +        if (!vcpu->online)
> +            continue;
> +
>          if (virCgroupNewThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, i,
>                                 false, &cgroup_temp) < 0 ||
>              virCgroupSetCpusetMemoryMigrate(cgroup_temp, true) < 0 ||
> @@ -1016,7 +1021,12 @@ qemuSetupCgroupForVcpu(virDomainObjPtr vm)
>                                              &mem_mask, -1) < 0)
>          goto cleanup;
> 
> -    for (i = 0; i < priv->nvcpupids; i++) {
> +    for (i = 0; i < virDomainDefGetVCpusMax(def); i++) {
> +        virDomainVCpuInfoPtr vcpu = virDomainDefGetVCpu(def, i);
> +

Same here

ACK w/ adjustments... That reminds me - patch 33 will have the same issue.

John
> +        if (!vcpu->online)
> +            continue;
> +
>          virCgroupFree(&cgroup_vcpu);
>          if (virCgroupNewThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, i,
>                                 true, &cgroup_vcpu) < 0)
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]