[libvirt] [PATCH 5/6] qemu: Change qemuDomainGetVcpuPinInfo bitmap manipulation

Ján Tomko jtomko at redhat.com
Sun Mar 8 10:51:17 UTC 2015


On Fri, Mar 06, 2015 at 01:47:11PM -0500, John Ferlan wrote:
> Follow-up to the IOThread review on CPU affinity map manipulation:
> 
> http://www.redhat.com/archives/libvir-list/2015-March/msg00294.html
> 
> indicates that the GetVcpuPinInfo could use similar algorithm adjustments
> which is what this patch does.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/qemu/qemu_driver.c | 59 ++++++++++++++++++++++++--------------------------
>  1 file changed, 28 insertions(+), 31 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index c1f4e95..85387a8 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -5100,12 +5100,8 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
>      virDomainObjPtr vm = NULL;
>      virDomainDefPtr targetDef = NULL;
>      int ret = -1;
> -    int maxcpu, hostcpus, vcpu, pcpu;
> -    int n;
> -    virDomainVcpuPinDefPtr *vcpupin_list;
> -    virBitmapPtr cpumask = NULL;
> +    int hostcpus, vcpu;
>      unsigned char *cpumap;
> -    bool pinned;
>      virCapsPtr caps = NULL;
>  
>      virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
> @@ -5133,39 +5129,40 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
>      if ((hostcpus = nodeGetCPUCount()) < 0)
>          goto cleanup;
>  
> -    maxcpu = maplen * 8;
> -    if (maxcpu > hostcpus)
> -        maxcpu = hostcpus;
> -

> -    /* Clamp to actual number of vcpus */
> -    if (ncpumaps > targetDef->vcpus)
> -        ncpumaps = targetDef->vcpus;
> -

This check can stay - we don't need to spend time returning a full
bitmap for vcpus that don't have a pin info beacuse they don't exist.

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/20150308/f32c7880/attachment-0001.sig>


More information about the libvir-list mailing list