From e98fee8390936477d369b9832ff9bb06594510c7 Mon Sep 17 00:00:00 2001 From: Dario Faggioli Date: Thu, 26 Jul 2012 15:41:54 +0100 Subject: 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 Acked-by: George Dunlap Acked-by: Ian Jackson Tested-by: Andre Przywara Committed-by: Ian Campbell --- docs/man/xl.cfg.pod.5 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'docs/man') diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5 index 314a03e339..8aaff1fec9 100644 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -111,8 +111,8 @@ created online and the remainder will be offline. =item B -List of which cpus the guest is allowed to use. Default behavior is -`all cpus`. A C may be specified as follows: +List of which cpus the guest is allowed to use. By default xl will pick +some cpus on its own (see below). A C may be specified as follows: =over 4 @@ -132,6 +132,12 @@ run on cpu #3 of the host. =back +If this option is not specified, libxl automatically tries to place the new +domain on the host's NUMA nodes (provided the host has more than one NUMA +node) by pinning it to the cpus of those nodes. A heuristic approach is +utilized with the goals of maximizing performance for the domain and, at +the same time, achieving efficient utilization of the host's CPUs and RAM. + =item B A domain with a weight of 512 will get twice as much CPU as a domain -- cgit v1.2.3