aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_create.c
diff options
context:
space:
mode:
authorDario Faggioli <dario.faggioli@citrix.com>2012-07-26 15:41:54 +0100
committerDario Faggioli <dario.faggioli@citrix.com>2012-07-26 15:41:54 +0100
commite98fee8390936477d369b9832ff9bb06594510c7 (patch)
tree485737b4c7bd3a9933296f3f52e6593f7b4f7570 /tools/libxl/libxl_create.c
parent47ce0e3550a2d1ce8407e3643ceb595657ac4d79 (diff)
downloadxen-e98fee8390936477d369b9832ff9bb06594510c7.tar.gz
xen-e98fee8390936477d369b9832ff9bb06594510c7.tar.bz2
xen-e98fee8390936477d369b9832ff9bb06594510c7.zip
libxl: enable automatic placement of guests on NUMA nodes
If a domain does not have a VCPU affinity, try to pin it automatically to some PCPUs. This is done taking into account the NUMA characteristics of the host. In fact, we look for a combination of host's NUMA nodes with enough free memory and number of PCPUs for the new domain, and pin it to the VCPUs of those nodes. Deciding which placement is the best happens by means of some heuristics. For instance, smaller candidates are better, both from a domain perspective (less memory spreading among nodes) and from the entire system perspective (smaller memory fragmentation). In case of candidates of equal sizes (i.e., with the same number of nodes), the amount of free memory and the number of domains' vCPUs already pinned to the candidates' nodes are both considered. Very often, candidates with greater amount of memory are the one we wants, as this is good for keeping memory fragmentation under control. However, we do not want to overcommit some node too much, just because it has a lot of memory, and that's why the number of vCPUs must be accounted for. This all happens internally to libxl, and no API for driving the mechanism is provided for now. This matches what xend already does. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Tested-by: Andre Przywara <andre.przywara@amd.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl/libxl_create.c')
-rw-r--r--tools/libxl/libxl_create.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 0c81a60972..3c950bab9c 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -215,6 +215,8 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
libxl_bitmap_set_any(&b_info->cpumap);
}
+ libxl_defbool_setdefault(&b_info->numa_placement, true);
+
if (b_info->max_memkb == LIBXL_MEMKB_DEFAULT)
b_info->max_memkb = 32 * 1024;
if (b_info->target_memkb == LIBXL_MEMKB_DEFAULT)