Re: [PATCH] cpustat: fix regression when cpus are offline

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

 



On 10/26/2012 07:59 AM, Peter Krempa wrote:
> On 10/25/12 22:57, Eric Blake wrote:
>> It turns out that the cpuacct results properly account for offline
>> cpus, and always returns results for every possible cpu, not just
>> the online ones.  So there is no need to check the map of online
>> cpus in the first place, merely only a need to know the maximum
>> possible cpu.  Meanwhile, virNodeGetCPUBitmap had a subtle change
>> from returning the maximum id to instead returning the width of
>> the bitmap (one larger than the maximum id), which made this code
>> encounter some off-by-one logic leading to bad error messages when
>> a cpu was offline:
>>

>       virBitmapPtr map = NULL;
>> -    virBitmapPtr map2 = NULL;
> 
> When you apply this patch "map" is also not needed (never actualy used).
> 
> Is there a way to replace
> "map = nodeGetCPUBitmap(domain->conn, &max_id);" to get max_id? That's
> the only thing that code is used to.
> 
>>       int rv = -1;
>>       int i, id, max_id;
>>       char *pos;
> 
> Otherwise looks good. (ACK if there isn't any other option to get max_id
> than to call nodeGetCPUBitmap)

Hmm, good point.  I'll spin a v2 that adds a new helper function in
nodeinfo.c for getting at just the number of host cpus.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]