[PATCHv2 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.
---

Notes:
    Version 2:
    - Already ACKed but didn't make sense to push.

 src/conf/numa_conf.c     | 13 +++++++++++++
 src/conf/numa_conf.h     |  2 ++
 src/libvirt_private.syms |  1 +
 3 files changed, 16 insertions(+)

diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 9caa655..517eaa1 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -894,3 +894,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 dc2ce58..ded6e01 100644
--- a/src/conf/numa_conf.h
+++ b/src/conf/numa_conf.h
@@ -95,6 +95,8 @@ virNumaMemAccess virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr numa,
 unsigned long long virDomainNumaGetNodeMemorySize(virDomainNumaPtr numa,
                                                   size_t node)
     ATTRIBUTE_NONNULL(1);
+unsigned long long virDomainNumaGetMemorySize(virDomainNumaPtr numa)
+    ATTRIBUTE_NONNULL(1);

 /*
  * Formatters
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index d4d0faf..9a32758 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]