[PATCH 6/7] conf: numa: Add helper to count total memory size configured in NUMA

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

 



The total NUMA memory consists of the sum of individual NUMA node memory
amounts.
---
 src/conf/numa_conf.c     | 13 +++++++++++++
 src/conf/numa_conf.h     |  1 +
 src/libvirt_private.syms |  1 +
 3 files changed, 15 insertions(+)

diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index fb9884a..a3e8ab2 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -892,3 +892,16 @@ virDomainNumaSetNodeMemorySize(virDomainNumaPtr numa,
 {
     numa->mem_nodes[node].mem = size;
 }
+
+
+unsigned long long
+virDomainNumaGetMemorySize(virDomainNumaPtr numa)
+{
+    size_t i;
+    unsigned long long ret = 0;
+
+    for (i = 0; i < numa->nmem_nodes; i++)
+        ret += numa->mem_nodes[i].mem;
+
+    return ret;
+}
diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h
index e0cc62d..184d045 100644
--- a/src/conf/numa_conf.h
+++ b/src/conf/numa_conf.h
@@ -91,6 +91,7 @@ virNumaMemAccess virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr numa,
                                                       size_t node);
 unsigned long long virDomainNumaGetNodeMemorySize(virDomainNumaPtr numa,
                                                   size_t node);
+unsigned long long virDomainNumaGetMemorySize(virDomainNumaPtr numa);


 /*
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index a58b2b9..e2eb40c 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -633,6 +633,7 @@ virNodeDeviceObjUnlock;
 virDomainNumaCheckABIStability;
 virDomainNumaEquals;
 virDomainNumaFree;
+virDomainNumaGetMemorySize;
 virDomainNumaGetNodeCount;
 virDomainNumaGetNodeCpumask;
 virDomainNumaGetNodeMemoryAccessMode;
-- 
2.2.2

--
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]