On Mon, Jul 20, 2015 at 18:37:30 +0200, Andrea Bolognani wrote:
Move the calls to the respective functions from virNodeParseNode(),
which is executed once for every NUMA node, to
linuxNodeInfoCPUPopulate(), which is executed just once per host.
---
src/nodeinfo.c | 53 +++++++++++++++++++++++++++++++----------------------
1 file changed, 31 insertions(+), 22 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 2328a86..31095a4 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -390,12 +390,15 @@ virNodeParseSocket(const char *dir,
/* parses a node entry, returning number of processors in the node and
* filling arguments */
static int
-ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
-ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5)
-ATTRIBUTE_NONNULL(6) ATTRIBUTE_NONNULL(7)
-virNodeParseNode(const char *sysfs_prefix,
- const char *node,
+ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3)
+ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(6)
+ATTRIBUTE_NONNULL(7) ATTRIBUTE_NONNULL(8)
+ATTRIBUTE_NONNULL(9)
+virNodeParseNode(const char *node,
virArch arch,
+ virBitmapPtr present_cpus_map,
+ int npresent_cpus,
+ virBitmapPtr online_cpus_map,
int *sockets,
int *cores,
int *threads,
@@ -408,12 +411,9 @@ virNodeParseNode(const char *sysfs_prefix,
int processors = 0;
DIR *cpudir = NULL;
struct dirent *cpudirent = NULL;
- virBitmapPtr present_cpumap = NULL;
- virBitmapPtr online_cpus_map = NULL;
virBitmapPtr node_cpus_map = NULL;
virBitmapPtr sockets_map = NULL;
virBitmapPtr *cores_maps = NULL;
- int npresent_cpus;
int sock_max = 0;
int sock;
int core;
@@ -431,15 +431,6 @@ virNodeParseNode(const char *sysfs_prefix,
goto cleanup;
}
- present_cpumap = nodeGetPresentCPUBitmap(sysfs_prefix);
- if (!present_cpumap)
- goto cleanup;
- online_cpus_map = nodeGetOnlineCPUBitmap(sysfs_prefix);
- if (!online_cpus_map)
- goto cleanup;
-
- npresent_cpus = virBitmapSize(present_cpumap);
This still can be extracted here since the caller doesn't care about the
npreset count so you are basically passing redundant info.
ACK to the rest. I'll revert this part and adjust the patch accordingly
before pushing.
Peter