[libvirt] [PATCH v2 10/10] nodeinfo: Calculate present and online CPUs only once

Andrea Bolognani abologna at redhat.com
Wed Jul 22 09:24:02 UTC 2015


On Wed, 2015-07-22 at 10:44 +0200, Peter Krempa wrote:
> 
> > -    present_cpumap = nodeGetPresentCPUBitmap(sysfs_prefix);
> > -    if (!present_cpumap)
> > -        goto cleanup;
> > -    online_cpus_map = nodeGetOnlineCPUBitmap(sysfs_prefix);
> > -    if (!online_cpus_map)
> > -        goto cleanup;
> > -
> > -    npresent_cpus = virBitmapSize(present_cpumap);
> 
> This still can be extracted here since the caller doesn't care about 
> the
> npreset count so you are basically passing redundant info.
> 
> ACK to the rest. I'll revert this part and adjust the patch 
> accordingly
> before pushing.

Sure, it was intended as an optimization but then again
we already agreed that it doesn't really make sense
because virBitmapSize() does so little, plus it indeed
looks cleaner if the caller is passing one less parameter.

Thanks.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team




More information about the libvir-list mailing list