31daccf virNumaGetHugePageInfo: Return page_avail and page_free as ULL

Authored and Committed by mprivozn 5 years ago
    virNumaGetHugePageInfo: Return page_avail and page_free as ULL
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1569678
    
    On some large systems (with ~400GB of RAM) it is possible for
    unsigned int to overflow in which case we report invalid number
    of 4K pages pool size. Switch to unsigned long long.
    
    We hit overflow in virNumaGetPages when doing:
    
        huge_page_sum += 1024 * page_size * page_avail;
    
    because although 'huge_page_sum' is an unsigned long long, the
    page_size and page_avail are both unsigned int, so the promotion
    to unsigned long long doesn't happen until the sum has been
    calculated, by which time we've already overflowed.
    
    Turning page_avail into a unsigned long long is not strictly
    needed until we need ability to represent more than 2^32
    4k pages, which equates to 16 TB of RAM. That's not
    outside the realm of possibility, so makes sense that we
    change it to unsigned long long to avoid future problems.
    
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    
        
file modified
+3 -2
file modified
+1 -1
file modified
+1 -1
file modified
+18 -14
file modified
+4 -4
file modified
+2 -2