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

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



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 redhat com>

-- 
Andrea Bolognani / Red Hat / Virtualization


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