.free_vdata = a653sched_free_vdata,
.alloc_vdata = a653sched_alloc_vdata,
- .init_domain = NULL,
- .destroy_domain = NULL,
-
.insert_vcpu = NULL,
.remove_vcpu = NULL,
return sdom;
}
-static int
-csched_dom_init(const struct scheduler *ops, struct domain *dom)
-{
- struct csched_dom *sdom;
-
- if ( is_idle_domain(dom) )
- return 0;
-
- sdom = csched_alloc_domdata(ops, dom);
- if ( IS_ERR(sdom) )
- return PTR_ERR(sdom);
-
- dom->sched_priv = sdom;
-
- return 0;
-}
-
static void
csched_free_domdata(const struct scheduler *ops, void *data)
{
xfree(data);
}
-static void
-csched_dom_destroy(const struct scheduler *ops, struct domain *dom)
-{
- csched_free_domdata(ops, CSCHED_DOM(dom));
-}
-
/*
* This is a O(n) optimized sort of the runq.
*
.sched_id = XEN_SCHEDULER_CREDIT,
.sched_data = NULL,
- .init_domain = csched_dom_init,
- .destroy_domain = csched_dom_destroy,
-
.insert_vcpu = csched_vcpu_insert,
.remove_vcpu = csched_vcpu_remove,
return sdom;
}
-static int
-csched2_dom_init(const struct scheduler *ops, struct domain *dom)
-{
- struct csched2_dom *sdom;
-
- if ( is_idle_domain(dom) )
- return 0;
-
- sdom = csched2_alloc_domdata(ops, dom);
- if ( IS_ERR(sdom) )
- return PTR_ERR(sdom);
-
- dom->sched_priv = sdom;
-
- return 0;
-}
-
static void
csched2_free_domdata(const struct scheduler *ops, void *data)
{
}
}
-static void
-csched2_dom_destroy(const struct scheduler *ops, struct domain *dom)
-{
- ASSERT(csched2_dom(dom)->nr_vcpus == 0);
-
- csched2_free_domdata(ops, csched2_dom(dom));
-}
-
static void
csched2_vcpu_insert(const struct scheduler *ops, struct vcpu *vc)
{
.sched_id = XEN_SCHEDULER_CREDIT2,
.sched_data = NULL,
- .init_domain = csched2_dom_init,
- .destroy_domain = csched2_dom_destroy,
-
.insert_vcpu = csched2_vcpu_insert,
.remove_vcpu = csched2_vcpu_remove,
}
}
-static int null_dom_init(const struct scheduler *ops, struct domain *d)
-{
- struct null_dom *ndom;
-
- if ( is_idle_domain(d) )
- return 0;
-
- ndom = null_alloc_domdata(ops, d);
- if ( IS_ERR(ndom) )
- return PTR_ERR(ndom);
-
- d->sched_priv = ndom;
-
- return 0;
-}
-static void null_dom_destroy(const struct scheduler *ops, struct domain *d)
-{
- null_free_domdata(ops, null_dom(d));
-}
-
/*
* vCPU to pCPU assignment and placement. This _only_ happens:
* - on insert,
.alloc_domdata = null_alloc_domdata,
.free_domdata = null_free_domdata,
- .init_domain = null_dom_init,
- .destroy_domain = null_dom_destroy,
-
.insert_vcpu = null_vcpu_insert,
.remove_vcpu = null_vcpu_remove,
}
}
-static int
-rt_dom_init(const struct scheduler *ops, struct domain *dom)
-{
- struct rt_dom *sdom;
-
- /* IDLE Domain does not link on rt_private */
- if ( is_idle_domain(dom) )
- return 0;
-
- sdom = rt_alloc_domdata(ops, dom);
- if ( IS_ERR(sdom) )
- return PTR_ERR(sdom);
-
- dom->sched_priv = sdom;
-
- return 0;
-}
-
-static void
-rt_dom_destroy(const struct scheduler *ops, struct domain *dom)
-{
- rt_free_domdata(ops, rt_dom(dom));
-}
-
static void *
rt_alloc_vdata(const struct scheduler *ops, struct vcpu *vc, void *dd)
{
.deinit_pdata = rt_deinit_pdata,
.alloc_domdata = rt_alloc_domdata,
.free_domdata = rt_free_domdata,
- .init_domain = rt_dom_init,
- .destroy_domain = rt_dom_destroy,
.alloc_vdata = rt_alloc_vdata,
.free_vdata = rt_free_vdata,
.insert_vcpu = rt_vcpu_insert,
int sched_init_domain(struct domain *d, int poolid)
{
+ void *sdom;
int ret;
ASSERT(d->cpupool == NULL);
+ ASSERT(d->domain_id < DOMID_FIRST_RESERVED);
if ( (ret = cpupool_add_domain(d, poolid)) )
return ret;
SCHED_STAT_CRANK(dom_init);
TRACE_1D(TRC_SCHED_DOM_ADD, d->domain_id);
- return SCHED_OP(dom_scheduler(d), init_domain, d);
+
+ sdom = sched_alloc_domdata(dom_scheduler(d), d);
+ if ( IS_ERR(sdom) )
+ return PTR_ERR(sdom);
+
+ d->sched_priv = sdom;
+
+ return 0;
}
void sched_destroy_domain(struct domain *d)
{
ASSERT(d->cpupool != NULL || is_idle_domain(d));
+ ASSERT(d->domain_id < DOMID_FIRST_RESERVED);
SCHED_STAT_CRANK(dom_destroy);
TRACE_1D(TRC_SCHED_DOM_REM, d->domain_id);
- SCHED_OP(dom_scheduler(d), destroy_domain, d);
+
+ sched_free_domdata(dom_scheduler(d), d->sched_priv);
+ d->sched_priv = NULL;
cpupool_rm_domain(d);
}
void (*switch_sched) (struct scheduler *, unsigned int,
void *, void *);
- int (*init_domain) (const struct scheduler *, struct domain *);
- void (*destroy_domain) (const struct scheduler *, struct domain *);
-
/* Activate / deactivate vcpus in a cpu pool */
void (*insert_vcpu) (const struct scheduler *, struct vcpu *);
void (*remove_vcpu) (const struct scheduler *, struct vcpu *);