virnuma.h 2.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 * virnuma.h: helper APIs for managing numa
 *
 * Copyright (C) 2011-2013 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/>.
 *
 */

#ifndef __VIR_NUMA_H__
# define __VIR_NUMA_H__

G
Gao feng 已提交
25 26 27 28
# include "internal.h"
# include "virbitmap.h"
# include "virutil.h"

29
typedef enum {
G
Gao feng 已提交
30 31 32 33 34
    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
35
} virNumaTuneMemPlacementMode;
G
Gao feng 已提交
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

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. */
};

53 54 55
char *virNumaGetAutoPlacementAdvice(unsigned short vcups,
                                    unsigned long long balloon);

G
Gao feng 已提交
56 57
int virNumaSetupMemoryPolicy(virNumaTuneDef numatune,
                             virBitmapPtr nodemask);
58 59

bool virNumaIsAvailable(void);
60
int virNumaGetMaxNode(void);
61
bool virNumaNodeIsAvailable(int node);
62 63 64
int virNumaGetDistances(int node,
                        int **distances,
                        int *ndistances);
65 66 67
int virNumaGetNodeMemory(int node,
                         unsigned long long *memsize,
                         unsigned long long *memfree);
68

69 70
unsigned int virNumaGetMaxCPUs(void);

71 72
int virNumaGetNodeCPUs(int node, virBitmapPtr *cpus);

73 74 75 76 77 78 79 80 81 82
int virNumaGetPageInfo(int node,
                       unsigned int page_size,
                       unsigned int *page_avail,
                       unsigned int *page_free);
int virNumaGetPages(int node,
                    unsigned int **pages_size,
                    unsigned int **pages_avail,
                    unsigned int **pages_free,
                    size_t *npages)
    ATTRIBUTE_NONNULL(5);
83
#endif /* __VIR_NUMA_H__ */