diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-11-06 11:03:04 +0000 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-11-06 11:03:04 +0000 |
commit | 1ad5dad74cdec8818fa47c6b6c8652d532fb87c8 (patch) | |
tree | 391e9a242988b98c0d4357034ec57081079ff13f /xen/common/sched_sedf.c | |
parent | 5c445c2f6dbd4e48712a5b6298c56df45f1ff158 (diff) | |
download | xen-1ad5dad74cdec8818fa47c6b6c8652d532fb87c8.tar.gz xen-1ad5dad74cdec8818fa47c6b6c8652d532fb87c8.tar.bz2 xen-1ad5dad74cdec8818fa47c6b6c8652d532fb87c8.zip |
[XEN] Re-jig VCPU initialisation -- VMX init requires generic VCPU
fields to already be allocated. This has led to a general cleanup of
domain and vcpu initialisation and destruction.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/common/sched_sedf.c')
-rw-r--r-- | xen/common/sched_sedf.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/xen/common/sched_sedf.c b/xen/common/sched_sedf.c index 3e041d860e..5b0029575f 100644 --- a/xen/common/sched_sedf.c +++ b/xen/common/sched_sedf.c @@ -333,14 +333,6 @@ static int sedf_init_vcpu(struct vcpu *v) { struct sedf_vcpu_info *inf; - if ( v->domain->sched_priv == NULL ) - { - v->domain->sched_priv = xmalloc(struct sedf_dom_info); - if ( v->domain->sched_priv == NULL ) - return -1; - memset(v->domain->sched_priv, 0, sizeof(struct sedf_dom_info)); - } - if ( (v->sched_priv = xmalloc(struct sedf_vcpu_info)) == NULL ) return -1; memset(v->sched_priv, 0, sizeof(struct sedf_vcpu_info)); @@ -398,15 +390,25 @@ static int sedf_init_vcpu(struct vcpu *v) return 0; } -static void sedf_destroy_domain(struct domain *d) +static void sedf_destroy_vcpu(struct vcpu *v) { - int i; + xfree(v->sched_priv); +} +static int sedf_init_domain(struct domain *d) +{ + d->sched_priv = xmalloc(struct sedf_dom_info); + if ( d->sched_priv == NULL ) + return -ENOMEM; + + memset(d->sched_priv, 0, sizeof(struct sedf_dom_info)); + + return 0; +} + +static void sedf_destroy_domain(struct domain *d) +{ xfree(d->sched_priv); - - for ( i = 0; i < MAX_VIRT_CPUS; i++ ) - if ( d->vcpu[i] ) - xfree(d->vcpu[i]->sched_priv); } /* @@ -1427,9 +1429,12 @@ struct scheduler sched_sedf_def = { .opt_name = "sedf", .sched_id = XEN_SCHEDULER_SEDF, - .init_vcpu = sedf_init_vcpu, + .init_domain = sedf_init_domain, .destroy_domain = sedf_destroy_domain, + .init_vcpu = sedf_init_vcpu, + .destroy_vcpu = sedf_destroy_vcpu, + .do_schedule = sedf_do_schedule, .dump_cpu_state = sedf_dump_cpu_state, .sleep = sedf_sleep, |