mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
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>
This commit is contained in:
1 parent
0b5e4f99ae
commit
735f8ebd53
1 file changed
+6
-7
@@ -2724,13 +2724,12 @@ class XendDomainInfo:
|
||||
candidate_node_list.append(i)
|
||||
best_node = find_relaxed_node(candidate_node_list)[0]
|
||||
cpumask = info['node_to_cpu'][best_node]
|
||||
cores_per_node = info['nr_cpus'] / info['nr_nodes']
|
||||
nodes_required = (self.info['VCPUs_max'] + cores_per_node - 1) / cores_per_node
|
||||
if nodes_required > 1:
|
||||
log.debug("allocating %d NUMA nodes", nodes_required)
|
||||
best_nodes = find_relaxed_node(filter(lambda x: x != best_node, range(0,info['nr_nodes'])))
|
||||
for i in best_nodes[:nodes_required - 1]:
|
||||
cpumask = cpumask + info['node_to_cpu'][i]
|
||||
best_nodes = find_relaxed_node(filter(lambda x: x != best_node, range(0,info['nr_nodes'])))
|
||||
for node_idx in best_nodes:
|
||||
if len(cpumask) >= self.info['VCPUs_max']:
|
||||
break
|
||||
cpumask = cpumask + info['node_to_cpu'][node_idx]
|
||||
log.debug("allocating additional NUMA node %d", node_idx)
|
||||
for v in range(0, self.info['VCPUs_max']):
|
||||
xc.vcpu_setaffinity(self.domid, v, cpumask)
|
||||
return index
|
||||
|
||||