diff --git a/xen/common/domain.c b/xen/common/domain.c index bd46a983aa..dc1813915d 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -595,6 +595,8 @@ int domain_kill(struct domain *d) BUG_ON(rc != -EAGAIN); break; } + if ( sched_move_domain(d, cpupool0) ) + return -EAGAIN; for_each_vcpu ( d, v ) unmap_vcpu_info(v); d->is_dying = DOMDYING_dead; @@ -777,8 +779,6 @@ static void complete_domain_destroy(struct rcu_head *head) sched_destroy_domain(d); - cpupool_rm_domain(d); - /* Free page used by xen oprofile buffer. */ #ifdef CONFIG_XENOPROF free_xenoprof_pages(d); @@ -825,6 +825,8 @@ void domain_destroy(struct domain *d) if ( _atomic_read(old) != 0 ) return; + cpupool_rm_domain(d); + /* Delete from task list and task hashtable. */ TRACE_1D(TRC_SCHED_DOM_REM, d->domain_id); spin_lock(&domlist_update_lock);