WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xend: Set default vcpu affinity for bette

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xend: Set default vcpu affinity for better performance in NUMA systems.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 28 Feb 2008 06:10:12 -0800
Delivery-date: Thu, 28 Feb 2008 06:10:18 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xend: Set default vcpu affinity for better performance in NUMA systems., Xen patchbot-unstable <=