[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xend: Set default vcpu affinity for better performance in NUMA systems.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1204118269 0 # Node ID b58180cf8ab8c69def4129f7152f136daf5e1596 # Parent 2b940e46857c0ddf5ef1e255e201a42caf310df6 xend: Set default vcpu affinity for better performance in NUMA systems. Signed-off-by: Duan Ronghui <ronghui.duan@xxxxxxxxx> --- tools/python/xen/xend/XendDomainInfo.py | 33 ++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+) diff -r 2b940e46857c -r b58180cf8ab8 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Wed Feb 27 13:16:02 2008 +0000 +++ b/tools/python/xen/xend/XendDomainInfo.py Wed Feb 27 13:17:49 2008 +0000 @@ -1963,6 +1963,39 @@ class XendDomainInfo: if self.info['cpus'] is not None and len(self.info['cpus']) > 0: for v in range(0, self.info['VCPUs_max']): xc.vcpu_setaffinity(self.domid, v, self.info['cpus']) + else: + info = xc.physinfo() + if info['nr_nodes'] > 1: + node_memory_list = info['node_to_memory'] + needmem = self.image.getRequiredAvailableMemory(self.info['memory_dynamic_max']) / 1024 + candidate_node_list = [] + for i in range(0, info['nr_nodes']): + if node_memory_list[i] >= needmem: + candidate_node_list.append(i) + if candidate_node_list is None or len(candidate_node_list) == 1: + index = node_memory_list.index( max(node_memory_list) ) + cpumask = info['node_to_cpu'][index] + else: + nodeload = [0] + nodeload = nodeload * info['nr_nodes'] + from xen.xend import XendDomain + doms = XendDomain.instance().list('all') + for dom in doms: + cpuinfo = dom.getVCPUInfo() + for vcpu in sxp.children(cpuinfo, 'vcpu'): + def vinfo(n, t): + return t(sxp.child_value(vcpu, n)) + cpumap = vinfo('cpumap', list) + for i in candidate_node_list: + node_cpumask = info['node_to_cpu'][i] + for j in node_cpumask: + if j in cpumap: + nodeload[i] += 1 + break + index = nodeload.index( min(nodeload) ) + cpumask = info['node_to_cpu'][index] + for v in range(0, self.info['VCPUs_max']): + xc.vcpu_setaffinity(self.domid, v, cpumask) # Use architecture- and image-specific calculations to determine # the various headrooms necessary, given the raw configured _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |