numatune: create new module for numatune

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@redhat.com>
This commit is contained in:
Martin Kletzander 2014-06-06 16:50:39 +02:00
parent 992000e6d8
commit 293d5f21b6
8 changed files with 106 additions and 42 deletions

View File

@ -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 \

View File

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

37
src/conf/numatune_conf.c Normal file
View File

@ -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@redhat.com>
*/
#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");

54
src/conf/numatune_conf.h Normal file
View File

@ -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@redhat.com>
*/
#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__ */

View File

@ -606,6 +606,13 @@ virNodeDeviceObjRemove;
virNodeDeviceObjUnlock;
# conf/numatune_conf.h
virDomainNumatuneMemModeTypeFromString;
virDomainNumatuneMemModeTypeToString;
virNumaTuneMemPlacementModeTypeFromString;
virNumaTuneMemPlacementModeTypeToString;
# conf/nwfilter_conf.h
virNWFilterCallbackDriversLock;
virNWFilterCallbackDriversUnlock;
@ -1680,8 +1687,6 @@ virNodeSuspendGetTargetMask;
# util/virnuma.h
virDomainNumatuneMemModeTypeFromString;
virDomainNumatuneMemModeTypeToString;
virNumaGetAutoPlacementAdvice;
virNumaGetDistances;
virNumaGetMaxNode;
@ -1691,8 +1696,7 @@ virNumaGetPages;
virNumaIsAvailable;
virNumaNodeIsAvailable;
virNumaSetupMemoryPolicy;
virNumaTuneMemPlacementModeTypeFromString;
virNumaTuneMemPlacementModeTypeToString;
# util/virobject.h
virClassForObject;

View File

@ -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"

View File

@ -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 *

View File

@ -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);