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

Ján Tomko jtomko at redhat.com
Wed Apr 8 12:38:35 UTC 2015


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 at 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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150408/3f3c3ae2/attachment-0001.sig>


More information about the libvir-list mailing list