aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/domain.c
diff options
context:
space:
mode:
authorJuergen Gross <juergen.gross@ts.fujitsu.com>2012-01-24 14:21:12 +0000
committerJuergen Gross <juergen.gross@ts.fujitsu.com>2012-01-24 14:21:12 +0000
commitb3b15b7611b00f96b08fd69d9e092da535855055 (patch)
tree6b33a37f15013c6f2a55a159abf8989177b1262d /xen/common/domain.c
parent79cf2c4c4f78e970e5e62b2d246b22cd4d1dc442 (diff)
downloadxen-b3b15b7611b00f96b08fd69d9e092da535855055.tar.gz
xen-b3b15b7611b00f96b08fd69d9e092da535855055.tar.bz2
xen-b3b15b7611b00f96b08fd69d9e092da535855055.zip
reflect cpupool in numa node affinity
In order to prefer node local memory for a domain the numa node locality info must be built according to the cpus belonging to the cpupool of the domain. Signed-off-by: juergen.gross@ts.fujitsu.com Committed-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/domain.c')
-rw-r--r--xen/common/domain.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 50cd32da18..fd202100ef 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -11,6 +11,7 @@
#include <xen/ctype.h>
#include <xen/errno.h>
#include <xen/sched.h>
+#include <xen/sched-if.h>
#include <xen/domain.h>
#include <xen/mm.h>
#include <xen/event.h>
@@ -335,17 +336,29 @@ struct domain *domain_create(
void domain_update_node_affinity(struct domain *d)
{
cpumask_var_t cpumask;
+ cpumask_var_t online_affinity;
+ const cpumask_t *online;
nodemask_t nodemask = NODE_MASK_NONE;
struct vcpu *v;
unsigned int node;
if ( !zalloc_cpumask_var(&cpumask) )
return;
+ if ( !alloc_cpumask_var(&online_affinity) )
+ {
+ free_cpumask_var(cpumask);
+ return;
+ }
+
+ online = cpupool_online_cpumask(d->cpupool);
spin_lock(&d->node_affinity_lock);
for_each_vcpu ( d, v )
- cpumask_or(cpumask, cpumask, v->cpu_affinity);
+ {
+ cpumask_and(online_affinity, v->cpu_affinity, online);
+ cpumask_or(cpumask, cpumask, online_affinity);
+ }
for_each_online_node ( node )
if ( cpumask_intersects(&node_to_cpumask(node), cpumask) )
@@ -354,6 +367,7 @@ void domain_update_node_affinity(struct domain *d)
d->node_affinity = nodemask;
spin_unlock(&d->node_affinity_lock);
+ free_cpumask_var(online_affinity);
free_cpumask_var(cpumask);
}