debuggers.hg

changeset 20848:aaf34d74b622

xend, NUMA: Fix computation of needed nodes

Enumerate the best nodes and add CPU affinity until all VCPUs can be
backed by at least one physical core. This should fix problems with
asymmetric NUMA configurations and cropped number of CPUs in Xen.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jan 14 09:44:08 2010 +0000 (2010-01-14)
parents ab5845cfa62d
children 50bd4235f486
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Jan 14 09:42:40 2010 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Jan 14 09:44:08 2010 +0000
     1.3 @@ -2724,13 +2724,12 @@ class XendDomainInfo:
     1.4                          candidate_node_list.append(i)
     1.5                  best_node = find_relaxed_node(candidate_node_list)[0]
     1.6                  cpumask = info['node_to_cpu'][best_node]
     1.7 -                cores_per_node = info['nr_cpus'] / info['nr_nodes']
     1.8 -                nodes_required = (self.info['VCPUs_max'] + cores_per_node - 1) / cores_per_node
     1.9 -                if nodes_required > 1:
    1.10 -                    log.debug("allocating %d NUMA nodes", nodes_required)
    1.11 -                    best_nodes = find_relaxed_node(filter(lambda x: x != best_node, range(0,info['nr_nodes'])))
    1.12 -                    for i in best_nodes[:nodes_required - 1]:
    1.13 -                        cpumask = cpumask + info['node_to_cpu'][i]
    1.14 +                best_nodes = find_relaxed_node(filter(lambda x: x != best_node, range(0,info['nr_nodes'])))
    1.15 +                for node_idx in best_nodes:
    1.16 +                    if len(cpumask) >= self.info['VCPUs_max']:
    1.17 +                        break
    1.18 +                    cpumask = cpumask + info['node_to_cpu'][node_idx]
    1.19 +                    log.debug("allocating additional NUMA node %d", node_idx)
    1.20                  for v in range(0, self.info['VCPUs_max']):
    1.21                      xc.vcpu_setaffinity(self.domid, v, cpumask)
    1.22          return index