Re: [PATCH 4/5] qemu: process: Extract gathering of 'numad' placement into a function

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

 



On Wed, 2017-07-12 at 15:44 +0200, Peter Krempa wrote:
> +static int
> +qemuProcessPrepareDomainNUMAPlacement(virDomainObjPtr vm,
> +                                      virCapsPtr caps)
> +{
> +    qemuDomainObjPrivatePtr priv = vm->privateData;
> +    char *nodesetstr = NULL;
> +    int ret = -1;
> +
> +    /* Get the advisory nodeset from numad if 'placement' of
> +     * either <vcpu> or <numatune> is 'auto'.
> +     */
> +    if (!virDomainDefNeedsPlacementAdvice(vm->def))
> +        return 0;
> +
> +    nodesetstr = virNumaGetAutoPlacementAdvice(virDomainDefGetVcpus(vm->def),
> +                                               virDomainDefGetMemoryTotal(vm->def));
> +
> +    if (!nodesetstr)
> +        goto cleanup;
> +
> +    VIR_DEBUG("Nodeset returned from numad: %s", nodesetstr);
> +
> +    if (virBitmapParse(nodesetstr, &priv->autoNodeset,
> +                       VIR_DOMAIN_CPUMASK_LEN) < 0)

This call is not any longer than others before or after it,
so there's no reason IMHO to distribute it among two lines.

You could even rename 'nodesetstr' to 'nodeset', which is
the name you've used for the same purpose in other places,
and shorten it a bit further ;)


Reviewed-by: Andrea Bolognani <abologna@xxxxxxxxxx>

-- 
Andrea Bolognani / Red Hat / Virtualization

--
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]
  Powered by Linux