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

Re: [libvirt] [PATCH v2 5/5] qemu: qemuDomainHotplugVcpus - separate out pin adjustment code



On Tue, Apr 07, 2015 at 09:23:17AM -0400, John Ferlan wrote:
> Future IOThread setting patches would copy the code anyway, so create
> and generalize the adding of pindef for the vcpu into its own API
> 
> Signed-off-by: John Ferlan <jferlan redhat com>
> ---
>  src/qemu/qemu_driver.c | 92 +++++++++++++++++++++++++++++---------------------
>  1 file changed, 54 insertions(+), 38 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index cec2758..1601ba3 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -4670,6 +4670,56 @@ qemuDomainHotplugAddCgroup(virCgroupPtr cgroup,
>  }
>  
>  static int
> +qemuDomainHotplugAddPin(virBitmapPtr cpumask,
> +                        int index,
> +                        pid_t pid,
> +                        virDomainPinDefPtr **pindef_list,
> +                        size_t *npin,
> +                        virCgroupPtr cgroup)
> +{
> +    int ret = -1;
> +    virDomainPinDefPtr pindef = NULL;
> +
> +    /* vm->def->cputune.* arrays can't be NULL if
> +     * vm->def->cpumask is not NULL.
> +     */
> +    if (VIR_ALLOC(pindef) < 0)
> +        goto cleanup;
> +
> +    if (!(pindef->cpumask = virBitmapNewCopy(cpumask))) {
> +        VIR_FREE(pindef);
> +        goto cleanup;
> +    }
> +    pindef->id = index;
> +    if (VIR_APPEND_ELEMENT_COPY(*pindef_list, *npin, pindef) < 0) {
> +        virBitmapFree(pindef->cpumask);
> +        VIR_FREE(pindef);
> +        goto cleanup;
> +    }

I'd rather split this function into two - one that adds the pin
definition and another that pins the thread

Jan.

Attachment: signature.asc
Description: Digital signature


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