diff options
author | Juergen Gross <juergen.gross@ts.fujitsu.com> | 2012-01-24 14:21:12 +0000 |
---|---|---|
committer | Juergen Gross <juergen.gross@ts.fujitsu.com> | 2012-01-24 14:21:12 +0000 |
commit | b3b15b7611b00f96b08fd69d9e092da535855055 (patch) | |
tree | 6b33a37f15013c6f2a55a159abf8989177b1262d /xen | |
parent | 79cf2c4c4f78e970e5e62b2d246b22cd4d1dc442 (diff) | |
download | xen-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')
-rw-r--r-- | xen/common/cpupool.c | 9 | ||||
-rw-r--r-- | xen/common/domain.c | 16 | ||||
-rw-r--r-- | xen/common/schedule.c | 10 |
3 files changed, 27 insertions, 8 deletions
diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c index 45162ad708..6cef4a003e 100644 --- a/xen/common/cpupool.c +++ b/xen/common/cpupool.c @@ -220,6 +220,7 @@ static int cpupool_assign_cpu_locked(struct cpupool *c, unsigned int cpu) { int ret; struct cpupool *old; + struct domain *d; if ( (cpupool_moving_cpu == cpu) && (c != cpupool_cpu_moving) ) return -EBUSY; @@ -240,6 +241,14 @@ static int cpupool_assign_cpu_locked(struct cpupool *c, unsigned int cpu) cpupool_cpu_moving = NULL; } cpumask_set_cpu(cpu, c->cpu_valid); + + rcu_read_lock(&domlist_read_lock); + for_each_domain_in_cpupool(d, c) + { + domain_update_node_affinity(d); + } + rcu_read_unlock(&domlist_read_lock); + return 0; } 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); } diff --git a/xen/common/schedule.c b/xen/common/schedule.c index c494017fc5..3505c8b302 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -280,12 +280,13 @@ int sched_move_domain(struct domain *d, struct cpupool *c) SCHED_OP(VCPU2OP(v), insert_vcpu, v); } - domain_update_node_affinity(d); d->cpupool = c; SCHED_OP(DOM2OP(d), free_domdata, d->sched_priv); d->sched_priv = domdata; + domain_update_node_affinity(d); + domain_unpause(d); xfree(vcpu_priv); @@ -535,7 +536,6 @@ int cpu_disable_scheduler(unsigned int cpu) struct cpupool *c; cpumask_t online_affinity; int ret = 0; - bool_t affinity_broken; c = per_cpu(cpupool, cpu); if ( c == NULL ) @@ -543,8 +543,6 @@ int cpu_disable_scheduler(unsigned int cpu) for_each_domain_in_cpupool ( d, c ) { - affinity_broken = 0; - for_each_vcpu ( d, v ) { vcpu_schedule_lock_irq(v); @@ -556,7 +554,6 @@ int cpu_disable_scheduler(unsigned int cpu) printk("Breaking vcpu affinity for domain %d vcpu %d\n", v->domain->domain_id, v->vcpu_id); cpumask_setall(v->cpu_affinity); - affinity_broken = 1; } if ( v->processor == cpu ) @@ -580,8 +577,7 @@ int cpu_disable_scheduler(unsigned int cpu) ret = -EAGAIN; } - if ( affinity_broken ) - domain_update_node_affinity(d); + domain_update_node_affinity(d); } return ret; |