|
|
9119d9 |
From 3eb8c8e054707378daf40b02ac6f23cf001132f7 Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <3eb8c8e054707378daf40b02ac6f23cf001132f7@dist-git>
|
|
|
9119d9 |
From: Martin Kletzander <mkletzan@redhat.com>
|
|
|
9119d9 |
Date: Thu, 15 Jan 2015 15:03:45 +0100
|
|
|
9119d9 |
Subject: [PATCH] util: Add virNumaGetHostNodeset
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1161540
|
|
|
9119d9 |
|
|
|
9119d9 |
That function tries its best to create a bitmap of host NUMA nodes.
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
9119d9 |
(cherry picked from commit d277d61420edf73f273338dcecf32d67009875f8)
|
|
|
9119d9 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/libvirt_private.syms | 1 +
|
|
|
9119d9 |
src/util/virnuma.c | 28 ++++++++++++++++++++++++++++
|
|
|
9119d9 |
src/util/virnuma.h | 1 +
|
|
|
9119d9 |
3 files changed, 30 insertions(+)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
|
|
9119d9 |
index 62f4f08..325a912 100644
|
|
|
9119d9 |
--- a/src/libvirt_private.syms
|
|
|
9119d9 |
+++ b/src/libvirt_private.syms
|
|
|
9119d9 |
@@ -1717,6 +1717,7 @@ virNodeSuspendGetTargetMask;
|
|
|
9119d9 |
# util/virnuma.h
|
|
|
9119d9 |
virNumaGetAutoPlacementAdvice;
|
|
|
9119d9 |
virNumaGetDistances;
|
|
|
9119d9 |
+virNumaGetHostNodeset;
|
|
|
9119d9 |
virNumaGetMaxNode;
|
|
|
9119d9 |
virNumaGetNodeMemory;
|
|
|
9119d9 |
virNumaGetPageInfo;
|
|
|
9119d9 |
diff --git a/src/util/virnuma.c b/src/util/virnuma.c
|
|
|
9119d9 |
index 1a34398..1b3280b 100644
|
|
|
9119d9 |
--- a/src/util/virnuma.c
|
|
|
9119d9 |
+++ b/src/util/virnuma.c
|
|
|
9119d9 |
@@ -867,3 +867,31 @@ virNumaGetPages(int node ATTRIBUTE_UNUSED,
|
|
|
9119d9 |
return -1;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
#endif /* #ifdef __linux__ */
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+virBitmapPtr
|
|
|
9119d9 |
+virNumaGetHostNodeset(void)
|
|
|
9119d9 |
+{
|
|
|
9119d9 |
+ int maxnode = virNumaGetMaxNode();
|
|
|
9119d9 |
+ size_t i = 0;
|
|
|
9119d9 |
+ virBitmapPtr nodeset = NULL;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ if (maxnode < 0)
|
|
|
9119d9 |
+ return NULL;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ if (!(nodeset = virBitmapNew(maxnode + 1)))
|
|
|
9119d9 |
+ return NULL;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ for (i = 0; i <= maxnode; i++) {
|
|
|
9119d9 |
+ if (!virNumaNodeIsAvailable(i))
|
|
|
9119d9 |
+ continue;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ if (virBitmapSetBit(nodeset, i) < 0) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
9119d9 |
+ _("Problem setting bit in bitmap"));
|
|
|
9119d9 |
+ virBitmapFree(nodeset);
|
|
|
9119d9 |
+ return NULL;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ return nodeset;
|
|
|
9119d9 |
+}
|
|
|
9119d9 |
diff --git a/src/util/virnuma.h b/src/util/virnuma.h
|
|
|
9119d9 |
index 13ebec6..9a6031f 100644
|
|
|
9119d9 |
--- a/src/util/virnuma.h
|
|
|
9119d9 |
+++ b/src/util/virnuma.h
|
|
|
9119d9 |
@@ -34,6 +34,7 @@ char *virNumaGetAutoPlacementAdvice(unsigned short vcups,
|
|
|
9119d9 |
int virNumaSetupMemoryPolicy(virDomainNumatunePtr numatune,
|
|
|
9119d9 |
virBitmapPtr nodemask);
|
|
|
9119d9 |
|
|
|
9119d9 |
+virBitmapPtr virNumaGetHostNodeset(void);
|
|
|
9119d9 |
bool virNumaIsAvailable(void);
|
|
|
9119d9 |
int virNumaGetMaxNode(void);
|
|
|
9119d9 |
bool virNumaNodeIsAvailable(int node);
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.2.1
|
|
|
9119d9 |
|