[PATCH v2 05/16] numatune: create new module for numatune

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

 



There are many places with numatune-related code that should be put
into special numatune_conf and this patch creates a basis for that.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/Makefile.am              |  3 ++-
 src/conf/domain_conf.h       |  2 +-
 src/conf/numatune_conf.c     | 37 ++++++++++++++++++++++++++++++
 src/conf/numatune_conf.h     | 54 ++++++++++++++++++++++++++++++++++++++++++++
 src/libvirt_private.syms     | 12 ++++++----
 src/qemu/qemu_capabilities.c |  1 +
 src/util/virnuma.c           | 13 +----------
 src/util/virnuma.h           | 26 ++-------------------
 8 files changed, 106 insertions(+), 42 deletions(-)
 create mode 100644 src/conf/numatune_conf.c
 create mode 100644 src/conf/numatune_conf.h

diff --git a/src/Makefile.am b/src/Makefile.am
index e2f76a7..48c8e33 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -252,7 +252,8 @@ DOMAIN_CONF_SOURCES =						\
 		conf/domain_conf.c conf/domain_conf.h		\
 		conf/domain_audit.c conf/domain_audit.h		\
 		conf/domain_nwfilter.c conf/domain_nwfilter.h	\
-		conf/snapshot_conf.c conf/snapshot_conf.h
+		conf/snapshot_conf.c conf/snapshot_conf.h	\
+		conf/numatune_conf.c conf/numatune_conf.h

 OBJECT_EVENT_SOURCES =						\
 		conf/object_event.c conf/object_event.h \
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a00e30a..018b516 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -36,6 +36,7 @@
 # include "virhash.h"
 # include "virsocketaddr.h"
 # include "nwfilter_params.h"
+# include "numatune_conf.h"
 # include "virnetdevmacvlan.h"
 # include "virsysinfo.h"
 # include "virnetdevvportprofile.h"
@@ -46,7 +47,6 @@
 # include "device_conf.h"
 # include "virbitmap.h"
 # include "virstoragefile.h"
-# include "virnuma.h"
 # include "virseclabel.h"

 /* forward declarations of all device types, required by
diff --git a/src/conf/numatune_conf.c b/src/conf/numatune_conf.c
new file mode 100644
index 0000000..e9be040
--- /dev/null
+++ b/src/conf/numatune_conf.c
@@ -0,0 +1,37 @@
+/*
+ * numatune_conf.c
+ *
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Martin Kletzander <mkletzan@xxxxxxxxxx>
+ */
+
+#include <config.h>
+
+#include "numatune_conf.h"
+
+VIR_ENUM_IMPL(virDomainNumatuneMemMode,
+              VIR_DOMAIN_NUMATUNE_MEM_LAST,
+              "strict",
+              "preferred",
+              "interleave");
+
+VIR_ENUM_IMPL(virNumaTuneMemPlacementMode,
+              VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST,
+              "default",
+              "static",
+              "auto");
diff --git a/src/conf/numatune_conf.h b/src/conf/numatune_conf.h
new file mode 100644
index 0000000..6bdfdc0
--- /dev/null
+++ b/src/conf/numatune_conf.h
@@ -0,0 +1,54 @@
+/*
+ * numatune_conf.h
+ *
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Martin Kletzander <mkletzan@xxxxxxxxxx>
+ */
+
+#ifndef __NUMATUNE_CONF_H__
+# define __NUMATUNE_CONF_H__
+
+# include "internal.h"
+# include "virutil.h"
+# include "virbitmap.h"
+
+typedef enum {
+    VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_DEFAULT = 0,
+    VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC,
+    VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO,
+
+    VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST
+} virDomainNumaTuneMemPlacementMode;
+
+VIR_ENUM_DECL(virNumaTuneMemPlacementMode)
+
+VIR_ENUM_DECL(virDomainNumatuneMemMode)
+
+typedef struct _virNumaTuneDef virNumaTuneDef;
+typedef virNumaTuneDef *virNumaTuneDefPtr;
+struct _virNumaTuneDef {
+    struct {
+        virBitmapPtr nodemask;
+        int mode;           /* enum virDomainNumatuneMemMode */
+        int placement_mode; /* enum virNumaTuneMemPlacementMode */
+    } memory;               /* pinning for all the memory */
+
+    /* Future NUMA tuning related stuff should go here. */
+};
+
+#endif /* __NUMATUNE_CONF_H__ */
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 6d7bf41..b51049e 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -606,6 +606,13 @@ virNodeDeviceObjRemove;
 virNodeDeviceObjUnlock;


+# conf/numatune_conf.h
+virDomainNumatuneMemModeTypeFromString;
+virDomainNumatuneMemModeTypeToString;
+virNumaTuneMemPlacementModeTypeFromString;
+virNumaTuneMemPlacementModeTypeToString;
+
+
 # conf/nwfilter_conf.h
 virNWFilterCallbackDriversLock;
 virNWFilterCallbackDriversUnlock;
@@ -1675,8 +1682,6 @@ virNodeSuspendGetTargetMask;


 # util/virnuma.h
-virDomainNumatuneMemModeTypeFromString;
-virDomainNumatuneMemModeTypeToString;
 virNumaGetAutoPlacementAdvice;
 virNumaGetDistances;
 virNumaGetMaxNode;
@@ -1686,8 +1691,7 @@ virNumaGetPages;
 virNumaIsAvailable;
 virNumaNodeIsAvailable;
 virNumaSetupMemoryPolicy;
-virNumaTuneMemPlacementModeTypeFromString;
-virNumaTuneMemPlacementModeTypeToString;
+

 # util/virobject.h
 virClassForObject;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index c665e2b..cbfc728 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -37,6 +37,7 @@
 #include "vircommand.h"
 #include "virbitmap.h"
 #include "virnodesuspend.h"
+#include "virnuma.h"
 #include "qemu_monitor.h"
 #include "virstring.h"
 #include "qemu_hostdev.h"
diff --git a/src/util/virnuma.c b/src/util/virnuma.c
index 207b804..de3f86a 100644
--- a/src/util/virnuma.c
+++ b/src/util/virnuma.c
@@ -1,7 +1,7 @@
 /*
  * virnuma.c: helper APIs for managing numa
  *
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -51,17 +51,6 @@

 VIR_LOG_INIT("util.numa");

-VIR_ENUM_IMPL(virDomainNumatuneMemMode,
-              VIR_DOMAIN_NUMATUNE_MEM_LAST,
-              "strict",
-              "preferred",
-              "interleave");
-
-VIR_ENUM_IMPL(virNumaTuneMemPlacementMode,
-              VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST,
-              "default",
-              "static",
-              "auto");

 #if HAVE_NUMAD
 char *
diff --git a/src/util/virnuma.h b/src/util/virnuma.h
index fbeb7a9..21e8125 100644
--- a/src/util/virnuma.h
+++ b/src/util/virnuma.h
@@ -1,7 +1,7 @@
 /*
  * virnuma.h: helper APIs for managing numa
  *
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,32 +23,10 @@
 # define __VIR_NUMA_H__

 # include "internal.h"
+# include "numatune_conf.h"
 # include "virbitmap.h"
 # include "virutil.h"

-typedef enum {
-    VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_DEFAULT = 0,
-    VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC,
-    VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO,
-
-    VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST
-} virNumaTuneMemPlacementMode;
-
-VIR_ENUM_DECL(virNumaTuneMemPlacementMode)
-
-VIR_ENUM_DECL(virDomainNumatuneMemMode)
-
-typedef struct _virNumaTuneDef virNumaTuneDef;
-typedef virNumaTuneDef *virNumaTuneDefPtr;
-struct _virNumaTuneDef {
-    struct {
-        virBitmapPtr nodemask;
-        int mode;
-        int placement_mode; /* enum virNumaTuneMemPlacementMode */
-    } memory;
-
-    /* Future NUMA tuning related stuff should go here. */
-};

 char *virNumaGetAutoPlacementAdvice(unsigned short vcups,
                                     unsigned long long balloon);
-- 
2.0.0

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