From: Andre Przywara <andre.przywara@amd.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] Allow explicit NUMA placements of guests
Date: Fri, 14 Mar 2008 15:34:11 +0100 [thread overview]
Message-ID: <47DA8CE3.2030606@amd.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 881 bytes --]
Hi,
this patch introduces a new config file option (numanodes=[x]) to
specify a list of valid NUMA nodes for guests. This will extend (but not
replace) the recently introduced automatic placement. If several nodes
are given, the current algorithm will choose one of them. If none of the
given nodes has enough memory, this will fall back to the automatic
placement.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Regards,
Andre.
--
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 277-84917
----to satisfy European Law for business letters:
AMD Saxony Limited Liability Company & Co. KG,
Wilschdorfer Landstr. 101, 01109 Dresden, Germany
Register Court Dresden: HRA 4896, General Partner authorized
to represent: AMD Saxony LLC (Wilmington, Delaware, US)
General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy
[-- Attachment #2: numa_explicit_placement.patch --]
[-- Type: text/plain, Size: 5529 bytes --]
# HG changeset patch
# User André Przywara <andre.przywara@amd.com>
# Date 1205504312 -3600
# Node ID 6ca722ad5208390ae9f671cac84238ed3ca42fdb
# Parent f33328217eee1a66bf2a874ff1a42b62c21e42bc
allow explicit numa node placement of guests
diff -r f33328217eee -r 6ca722ad5208 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py Mon Mar 10 22:51:57 2008 +0000
+++ b/tools/python/xen/xend/XendConfig.py Fri Mar 14 15:18:32 2008 +0100
@@ -152,6 +152,7 @@ XENAPI_CFG_TYPES = {
'memory_dynamic_min': int,
'memory_dynamic_max': int,
'cpus': list,
+ 'numanodes': list,
'vcpus_params': dict,
'VCPUs_max': int,
'VCPUs_at_startup': int,
@@ -329,6 +330,7 @@ class XendConfig(dict):
'on_xend_start': 'ignore',
'on_xend_stop': 'ignore',
'cpus': [],
+ 'numanodes': None,
'VCPUs_max': 1,
'VCPUs_live': 1,
'VCPUs_at_startup': 1,
diff -r f33328217eee -r 6ca722ad5208 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Mon Mar 10 22:51:57 2008 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py Fri Mar 14 15:18:32 2008 +0100
@@ -1969,34 +1969,38 @@ class XendDomainInfo:
else:
info = xc.physinfo()
if info['nr_nodes'] > 1:
+ candidate_node_list = []
+ if self.info['numanodes'] is None:
+ for i in range (0, info['nr_nodes']):
+ candidate_node_list.append(i)
+ else:
+ for node in self.info['numanodes']:
+ if node < info['nr_nodes']:
+ candidate_node_list.append (node)
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:
+ for i in candidate_node_list:
+ if node_memory_list[i] < needmem:
+ candidate_node_list.remove (i)
+ if candidate_node_list is None or len(candidate_node_list) == 0:
index = node_memory_list.index( max(node_memory_list) )
- cpumask = info['node_to_cpu'][index]
+ elif len(candidate_node_list) == 1:
+ index = candidate_node_list[0]
else:
- nodeload = [0]
- nodeload = nodeload * info['nr_nodes']
+ nodeload = [0] * 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)
+ cpumap = list(sxp.child_value(vcpu, 'cpumap'))
for i in candidate_node_list:
- node_cpumask = info['node_to_cpu'][i]
- for j in node_cpumask:
+ for j in info['node_to_cpu'][candidate_node_list[i]]:
if j in cpumap:
nodeload[i] += 1
break
- index = nodeload.index( min(nodeload) )
- cpumask = info['node_to_cpu'][index]
+ index = candidate_node_list[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)
diff -r f33328217eee -r 6ca722ad5208 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py Mon Mar 10 22:51:57 2008 +0000
+++ b/tools/python/xen/xm/create.py Fri Mar 14 15:18:32 2008 +0100
@@ -189,6 +189,10 @@ gopts.var('cpus', val='CPUS',
gopts.var('cpus', val='CPUS',
fn=set_value, default=None,
use="CPUS to run the domain on.")
+
+gopts.var('numanodes', val='NUMANODES',
+ fn=set_value, default=[],
+ use="NUMA nodes to run the domain on.")
gopts.var('rtc_timeoffset', val='RTC_TIMEOFFSET',
fn=set_value, default="0",
@@ -769,7 +773,7 @@ def make_config(vals):
map(add_conf, ['name', 'memory', 'maxmem', 'shadow_memory',
'restart', 'on_poweroff',
'on_reboot', 'on_crash', 'vcpus', 'vcpu_avail', 'features',
- 'on_xend_start', 'on_xend_stop', 'target'])
+ 'on_xend_start', 'on_xend_stop', 'target', 'numanodes'])
if vals.uuid is not None:
config.append(['uuid', vals.uuid])
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2008-03-14 14:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-14 14:34 Andre Przywara [this message]
2008-03-16 14:09 ` [PATCH] Allow explicit NUMA placements of guests John Levon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47DA8CE3.2030606@amd.com \
--to=andre.przywara@amd.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.