[libvirt] [PATCH 09/10] nodeinfo: Use a bitmap to keep track of node CPUs

Andrea Bolognani abologna at redhat.com
Mon Jul 20 16:33:33 UTC 2015


On Mon, 2015-07-20 at 15:47 +0200, Peter Krempa wrote:
> 
> > +    /* Iterate over all CPUs in the node, in ascending order */
> > +    for (cpu = 0; cpu < npresent_cpus; cpu++) {
> >  
> > -        if (!virBitmapIsBitSet(present_cpumap, cpu))
> > +        /* Skip CPUs that are not part of the current node */
> > +        if (!virBitmapIsBitSet(node_cpus_map, cpu))
> 
> Perhaps you can use virBitmapNextSetBit to simplify the iteration.
> 
> >              continue;
> >  
> >          if (!virBitmapIsBitSet(online_cpus_map, cpu)) {
> 
> ACK with or without the iteration modified.

I tried following your suggestion but I didn't like the
result very much, so I've left the loop as-is in v2.

Cheers.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team




More information about the libvir-list mailing list