mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen: Remove buggy initial placement algorithm
The initial placement algorithm sometimes picks cpus outside of the
mask it's given, does a lot of unnecessary bitmasking, does its own
separate load calculation, and completely ignores vcpu hard and soft
affinities. Just get rid of it and rely on the schedulers to do
initial placement.
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: d5438accce
master date: 2016-07-26 10:44:06 +0100
This commit is contained in:
1 parent
c421378a8d
commit
505ad3a8b7
1 file changed
+1
-49
+1
-49
@@ -215,54 +215,6 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info)
|
||||
memcpy(info->handle, d->handle, sizeof(xen_domain_handle_t));
|
||||
}
|
||||
|
||||
static unsigned int default_vcpu0_location(cpumask_t *online)
|
||||
{
|
||||
struct domain *d;
|
||||
struct vcpu *v;
|
||||
unsigned int i, cpu, nr_cpus, *cnt;
|
||||
cpumask_t cpu_exclude_map;
|
||||
|
||||
/* Do an initial CPU placement. Pick the least-populated CPU. */
|
||||
nr_cpus = cpumask_last(&cpu_online_map) + 1;
|
||||
cnt = xzalloc_array(unsigned int, nr_cpus);
|
||||
if ( cnt )
|
||||
{
|
||||
rcu_read_lock(&domlist_read_lock);
|
||||
for_each_domain ( d )
|
||||
for_each_vcpu ( d, v )
|
||||
if ( !test_bit(_VPF_down, &v->pause_flags)
|
||||
&& ((cpu = v->processor) < nr_cpus) )
|
||||
cnt[cpu]++;
|
||||
rcu_read_unlock(&domlist_read_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we're on a HT system, we only auto-allocate to a non-primary HT. We
|
||||
* favour high numbered CPUs in the event of a tie.
|
||||
*/
|
||||
cpumask_copy(&cpu_exclude_map, per_cpu(cpu_sibling_mask, 0));
|
||||
cpu = cpumask_first(&cpu_exclude_map);
|
||||
i = cpumask_next(cpu, &cpu_exclude_map);
|
||||
if ( i < nr_cpu_ids )
|
||||
cpu = i;
|
||||
for_each_cpu(i, online)
|
||||
{
|
||||
if ( cpumask_test_cpu(i, &cpu_exclude_map) )
|
||||
continue;
|
||||
if ( (i == cpumask_first(per_cpu(cpu_sibling_mask, i))) &&
|
||||
(cpumask_next(i, per_cpu(cpu_sibling_mask, i)) < nr_cpu_ids) )
|
||||
continue;
|
||||
cpumask_or(&cpu_exclude_map, &cpu_exclude_map,
|
||||
per_cpu(cpu_sibling_mask, i));
|
||||
if ( !cnt || cnt[i] <= cnt[cpu] )
|
||||
cpu = i;
|
||||
}
|
||||
|
||||
xfree(cnt);
|
||||
|
||||
return cpu;
|
||||
}
|
||||
|
||||
bool_t domctl_lock_acquire(void)
|
||||
{
|
||||
/*
|
||||
@@ -678,7 +630,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
|
||||
continue;
|
||||
|
||||
cpu = (i == 0) ?
|
||||
default_vcpu0_location(online) :
|
||||
cpumask_any(online) :
|
||||
cpumask_cycle(d->vcpu[i-1]->processor, online);
|
||||
|
||||
if ( alloc_vcpu(d, i, cpu) == NULL )
|
||||
|
||||