From: hejia hejia <jiakernel@xxxxxxxxx> nodeGetFreeMemory and nodeGetCellsFreeMemory assumed that the NUMA nodes are contiguous and starting from 0. Unfortunately there are machines that don't match this assumption: available: 1 nodes (1) node 1 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 node 1 size: 16340 MB node 1 free: 11065 MB Before this patch: error: internal error Failed to query NUMA free memory error: internal error Failed to query NUMA free memory for node: 0 After this patch: Total: 15772580 KiB 0: 0 KiB Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/nodeinfo.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index a2a2f73..4df4851 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -1686,12 +1686,9 @@ nodeGetCellsFreeMemory(unsigned long long *freeMems, for (numCells = 0, n = startCell; n <= lastCell; n++) { long long mem; - if (numa_node_size64(n, &mem) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to query NUMA free memory for node: %d"), - n); - goto cleanup; - } + if (numa_node_size64(n, &mem) < 0) + mem = 0; + freeMems[numCells++] = mem; } ret = numCells; @@ -1712,15 +1709,12 @@ nodeGetFreeMemory(void) for (n = 0; n <= numa_max_node(); n++) { long long mem; - if (numa_node_size64(n, &mem) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Failed to query NUMA free memory")); - goto cleanup; - } + if (numa_node_size64(n, &mem) < 0) + continue; + freeMem += mem; } -cleanup: return freeMem; } -- 1.8.3.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list