[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] scheduler: const-ify references to 'struct scheduler' where possible.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1273009354 -3600 # Node ID df8c580b523a0512ec294098e17711dfe93ea8a4 # Parent a455cae31549e74791a28455537c9fe7ec20f077 scheduler: const-ify references to 'struct scheduler' where possible. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- xen/common/sched_credit.c | 46 ++++++++++++++++++++++----------------------- xen/common/sched_credit2.c | 46 ++++++++++++++++++++++----------------------- xen/common/sched_sedf.c | 34 ++++++++++++++++----------------- xen/include/xen/sched-if.h | 44 ++++++++++++++++++++++--------------------- 4 files changed, 86 insertions(+), 84 deletions(-) diff -r a455cae31549 -r df8c580b523a xen/common/sched_credit.c --- a/xen/common/sched_credit.c Tue May 04 22:20:05 2010 +0100 +++ b/xen/common/sched_credit.c Tue May 04 22:42:34 2010 +0100 @@ -303,7 +303,7 @@ __runq_tickle(unsigned int cpu, struct c } static void -csched_free_pdata(struct scheduler *ops, void *pcpu, int cpu) +csched_free_pdata(const struct scheduler *ops, void *pcpu, int cpu) { struct csched_private *prv = CSCHED_PRIV(ops); struct csched_pcpu *spc = pcpu; @@ -333,7 +333,7 @@ csched_free_pdata(struct scheduler *ops, } static void * -csched_alloc_pdata(struct scheduler *ops, int cpu) +csched_alloc_pdata(const struct scheduler *ops, int cpu) { struct csched_pcpu *spc; struct csched_private *prv = CSCHED_PRIV(ops); @@ -448,7 +448,7 @@ __csched_vcpu_is_migrateable(struct vcpu } static int -_csched_cpu_pick(struct scheduler *ops, struct vcpu *vc, bool_t commit) +_csched_cpu_pick(const struct scheduler *ops, struct vcpu *vc, bool_t commit) { cpumask_t cpus; cpumask_t idlers; @@ -524,7 +524,7 @@ _csched_cpu_pick(struct scheduler *ops, } static int -csched_cpu_pick(struct scheduler *ops, struct vcpu *vc) +csched_cpu_pick(const struct scheduler *ops, struct vcpu *vc) { return _csched_cpu_pick(ops, vc, 1); } @@ -579,7 +579,7 @@ csched_vcpu_acct(struct csched_private * csched_vcpu_acct(struct csched_private *prv, unsigned int cpu) { struct csched_vcpu * const svc = CSCHED_VCPU(current); - struct scheduler *ops = per_cpu(scheduler, cpu); + const struct scheduler *ops = per_cpu(scheduler, cpu); ASSERT( current->processor == cpu ); ASSERT( svc->sdom != NULL ); @@ -620,7 +620,7 @@ csched_vcpu_acct(struct csched_private * } static void * -csched_alloc_vdata(struct scheduler *ops, struct vcpu *vc, void *dd) +csched_alloc_vdata(const struct scheduler *ops, struct vcpu *vc, void *dd) { struct csched_vcpu *svc; @@ -644,7 +644,7 @@ csched_alloc_vdata(struct scheduler *ops } static void -csched_vcpu_insert(struct scheduler *ops, struct vcpu *vc) +csched_vcpu_insert(const struct scheduler *ops, struct vcpu *vc) { struct csched_vcpu *svc = vc->sched_priv; @@ -653,7 +653,7 @@ csched_vcpu_insert(struct scheduler *ops } static void -csched_free_vdata(struct scheduler *ops, void *priv) +csched_free_vdata(const struct scheduler *ops, void *priv) { struct csched_private *prv = CSCHED_PRIV(ops); struct csched_vcpu *svc = priv; @@ -673,7 +673,7 @@ csched_free_vdata(struct scheduler *ops, } static void -csched_vcpu_destroy(struct scheduler *ops, struct vcpu *vc) +csched_vcpu_destroy(const struct scheduler *ops, struct vcpu *vc) { struct csched_vcpu * const svc = CSCHED_VCPU(vc); struct csched_dom * const sdom = svc->sdom; @@ -687,7 +687,7 @@ csched_vcpu_destroy(struct scheduler *op } static void -csched_vcpu_sleep(struct scheduler *ops, struct vcpu *vc) +csched_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc) { struct csched_vcpu * const svc = CSCHED_VCPU(vc); @@ -702,7 +702,7 @@ csched_vcpu_sleep(struct scheduler *ops, } static void -csched_vcpu_wake(struct scheduler *ops, struct vcpu *vc) +csched_vcpu_wake(const struct scheduler *ops, struct vcpu *vc) { struct csched_vcpu * const svc = CSCHED_VCPU(vc); const unsigned int cpu = vc->processor; @@ -758,7 +758,7 @@ csched_vcpu_wake(struct scheduler *ops, static int csched_dom_cntl( - struct scheduler *ops, + const struct scheduler *ops, struct domain *d, struct xen_domctl_scheduler_op *op) { @@ -797,7 +797,7 @@ csched_dom_cntl( } static void * -csched_alloc_domdata(struct scheduler *ops, struct domain *dom) +csched_alloc_domdata(const struct scheduler *ops, struct domain *dom) { struct csched_dom *sdom; @@ -818,7 +818,7 @@ csched_alloc_domdata(struct scheduler *o } static int -csched_dom_init(struct scheduler *ops, struct domain *dom) +csched_dom_init(const struct scheduler *ops, struct domain *dom) { struct csched_dom *sdom; @@ -837,13 +837,13 @@ csched_dom_init(struct scheduler *ops, s } static void -csched_free_domdata(struct scheduler *ops, void *data) +csched_free_domdata(const struct scheduler *ops, void *data) { xfree(data); } static void -csched_dom_destroy(struct scheduler *ops, struct domain *dom) +csched_dom_destroy(const struct scheduler *ops, struct domain *dom) { CSCHED_STAT_CRANK(dom_destroy); csched_free_domdata(ops, CSCHED_DOM(dom)); @@ -1243,7 +1243,7 @@ csched_load_balance(struct csched_privat * fast for the common case. */ static struct task_slice -csched_schedule(struct scheduler *ops, s_time_t now) +csched_schedule(const struct scheduler *ops, s_time_t now) { const int cpu = smp_processor_id(); struct list_head * const runq = RUNQ(cpu); @@ -1355,7 +1355,7 @@ csched_dump_vcpu(struct csched_vcpu *svc } static void -csched_dump_pcpu(struct scheduler *ops, int cpu) +csched_dump_pcpu(const struct scheduler *ops, int cpu) { struct list_head *runq, *iter; struct csched_pcpu *spc; @@ -1393,7 +1393,7 @@ csched_dump_pcpu(struct scheduler *ops, } static void -csched_dump(struct scheduler *ops) +csched_dump(const struct scheduler *ops) { struct list_head *iter_sdom, *iter_svc; struct csched_private *prv = CSCHED_PRIV(ops); @@ -1503,7 +1503,7 @@ __initcall(csched_start_tickers); __initcall(csched_start_tickers); static void -csched_deinit(struct scheduler *ops) +csched_deinit(const struct scheduler *ops) { struct csched_private *prv; @@ -1512,7 +1512,7 @@ csched_deinit(struct scheduler *ops) xfree(prv); } -static void csched_tick_suspend(struct scheduler *ops, unsigned int cpu) +static void csched_tick_suspend(const struct scheduler *ops, unsigned int cpu) { struct csched_pcpu *spc; @@ -1521,7 +1521,7 @@ static void csched_tick_suspend(struct s stop_timer(&spc->ticker); } -static void csched_tick_resume(struct scheduler *ops, unsigned int cpu) +static void csched_tick_resume(const struct scheduler *ops, unsigned int cpu) { struct csched_pcpu *spc; uint64_t now = NOW(); @@ -1548,7 +1548,7 @@ static void csched_tick_resume(struct sc static struct csched_private _csched_priv; -struct scheduler sched_credit_def = { +const struct scheduler sched_credit_def = { .name = "SMP Credit Scheduler", .opt_name = "credit", .sched_id = XEN_SCHEDULER_CREDIT, diff -r a455cae31549 -r df8c580b523a xen/common/sched_credit2.c --- a/xen/common/sched_credit2.c Tue May 04 22:20:05 2010 +0100 +++ b/xen/common/sched_credit2.c Tue May 04 22:42:34 2010 +0100 @@ -283,7 +283,7 @@ __runq_insert(struct list_head *runq, st } static void -runq_insert(struct scheduler *ops, unsigned int cpu, struct csched_vcpu *svc) +runq_insert(const struct scheduler *ops, unsigned int cpu, struct csched_vcpu *svc) { struct list_head * runq = &RQD(ops, cpu)->runq; int pos = 0; @@ -323,7 +323,7 @@ void burn_credits(struct csched_runqueue /* Check to see if the item on the runqueue is higher priority than what's * currently running; if so, wake up the processor */ static /*inline*/ void -runq_tickle(struct scheduler *ops, unsigned int cpu, struct csched_vcpu *new, s_time_t now) +runq_tickle(const struct scheduler *ops, unsigned int cpu, struct csched_vcpu *new, s_time_t now) { int i, ipid=-1; s_time_t lowest=(1<<30); @@ -397,7 +397,7 @@ runq_tickle(struct scheduler *ops, unsig /* * Credit-related code */ -static void reset_credit(struct scheduler *ops, int cpu, s_time_t now) +static void reset_credit(const struct scheduler *ops, int cpu, s_time_t now) { struct list_head *iter; @@ -523,7 +523,7 @@ __csched_vcpu_check(struct vcpu *vc) #endif static void * -csched_alloc_vdata(struct scheduler *ops, struct vcpu *vc, void *dd) +csched_alloc_vdata(const struct scheduler *ops, struct vcpu *vc, void *dd) { struct csched_vcpu *svc; @@ -559,7 +559,7 @@ csched_alloc_vdata(struct scheduler *ops } static void -csched_vcpu_insert(struct scheduler *ops, struct vcpu *vc) +csched_vcpu_insert(const struct scheduler *ops, struct vcpu *vc) { struct csched_vcpu *svc = vc->sched_priv; struct domain * const dom = vc->domain; @@ -589,7 +589,7 @@ csched_vcpu_insert(struct scheduler *ops } static void -csched_free_vdata(struct scheduler *ops, void *priv) +csched_free_vdata(const struct scheduler *ops, void *priv) { struct csched_vcpu *svc = priv; struct vcpu *vc = svc->vcpu; @@ -615,7 +615,7 @@ csched_free_vdata(struct scheduler *ops, } static void -csched_vcpu_destroy(struct scheduler *ops, struct vcpu *vc) +csched_vcpu_destroy(const struct scheduler *ops, struct vcpu *vc) { struct csched_vcpu * const svc = CSCHED_VCPU(vc); struct csched_dom * const sdom = svc->sdom; @@ -627,7 +627,7 @@ csched_vcpu_destroy(struct scheduler *op } static void -csched_vcpu_sleep(struct scheduler *ops, struct vcpu *vc) +csched_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc) { struct csched_vcpu * const svc = CSCHED_VCPU(vc); @@ -640,7 +640,7 @@ csched_vcpu_sleep(struct scheduler *ops, } static void -csched_vcpu_wake(struct scheduler *ops, struct vcpu *vc) +csched_vcpu_wake(const struct scheduler *ops, struct vcpu *vc) { struct csched_vcpu * const svc = CSCHED_VCPU(vc); const unsigned int cpu = vc->processor; @@ -686,7 +686,7 @@ out: } static void -csched_context_saved(struct scheduler *ops, struct vcpu *vc) +csched_context_saved(const struct scheduler *ops, struct vcpu *vc) { struct csched_vcpu * const svc = CSCHED_VCPU(vc); @@ -719,7 +719,7 @@ csched_context_saved(struct scheduler *o } static int -csched_cpu_pick(struct scheduler *ops, struct vcpu *vc) +csched_cpu_pick(const struct scheduler *ops, struct vcpu *vc) { /* FIXME: Chose a schedule group based on load */ /* FIXME: Migrate the vcpu to the new runqueue list, updating @@ -729,7 +729,7 @@ csched_cpu_pick(struct scheduler *ops, s static int csched_dom_cntl( - struct scheduler *ops, + const struct scheduler *ops, struct domain *d, struct xen_domctl_scheduler_op *op) { @@ -782,7 +782,7 @@ csched_dom_cntl( } static void * -csched_alloc_domdata(struct scheduler *ops, struct domain *dom) +csched_alloc_domdata(const struct scheduler *ops, struct domain *dom) { struct csched_dom *sdom; int flags; @@ -809,7 +809,7 @@ csched_alloc_domdata(struct scheduler *o } static int -csched_dom_init(struct scheduler *ops, struct domain *dom) +csched_dom_init(const struct scheduler *ops, struct domain *dom) { struct csched_dom *sdom; @@ -828,7 +828,7 @@ csched_dom_init(struct scheduler *ops, s } static void -csched_free_domdata(struct scheduler *ops, void *data) +csched_free_domdata(const struct scheduler *ops, void *data) { int flags; struct csched_dom *sdom = data; @@ -843,7 +843,7 @@ csched_free_domdata(struct scheduler *op } static void -csched_dom_destroy(struct scheduler *ops, struct domain *dom) +csched_dom_destroy(const struct scheduler *ops, struct domain *dom) { struct csched_dom *sdom = CSCHED_DOM(dom); @@ -854,7 +854,7 @@ csched_dom_destroy(struct scheduler *ops /* How long should we let this vcpu run for? */ static s_time_t -csched_runtime(struct scheduler *ops, int cpu, struct csched_vcpu *snext) +csched_runtime(const struct scheduler *ops, int cpu, struct csched_vcpu *snext) { s_time_t time = CSCHED_MAX_TIMER; struct csched_runqueue_data *rqd = RQD(ops, cpu); @@ -897,7 +897,7 @@ void __dump_execstate(void *unused); * fast for the common case. */ static struct task_slice -csched_schedule(struct scheduler *ops, s_time_t now) +csched_schedule(const struct scheduler *ops, s_time_t now) { const int cpu = smp_processor_id(); struct csched_runqueue_data *rqd = RQD(ops, cpu); @@ -1023,7 +1023,7 @@ csched_dump_vcpu(struct csched_vcpu *svc } static void -csched_dump_pcpu(struct scheduler *ops, int cpu) +csched_dump_pcpu(const struct scheduler *ops, int cpu) { struct list_head *runq, *iter; struct csched_vcpu *svc; @@ -1060,7 +1060,7 @@ csched_dump_pcpu(struct scheduler *ops, } static void -csched_dump(struct scheduler *ops) +csched_dump(const struct scheduler *ops) { struct list_head *iter_sdom, *iter_svc; struct csched_private *prv = CSCHED_PRIV(ops); @@ -1093,7 +1093,7 @@ csched_dump(struct scheduler *ops) } static void -make_runq_map(struct scheduler *ops) +make_runq_map(const struct scheduler *ops) { int cpu, cpu_count=0; struct csched_private *prv = CSCHED_PRIV(ops); @@ -1162,7 +1162,7 @@ csched_init(struct scheduler *ops, int p } static void -csched_deinit(struct scheduler *ops) +csched_deinit(const struct scheduler *ops) { struct csched_private *prv; @@ -1174,7 +1174,7 @@ csched_deinit(struct scheduler *ops) static struct csched_private _csched_priv; -struct scheduler sched_credit2_def = { +const struct scheduler sched_credit2_def = { .name = "SMP Credit Scheduler rev2", .opt_name = "credit2", .sched_id = XEN_SCHEDULER_CREDIT2, diff -r a455cae31549 -r df8c580b523a xen/common/sched_sedf.c --- a/xen/common/sched_sedf.c Tue May 04 22:20:05 2010 +0100 +++ b/xen/common/sched_sedf.c Tue May 04 22:42:34 2010 +0100 @@ -135,7 +135,7 @@ struct sedf_cpu_info { #define sedf_runnable(edom) (!(EDOM_INFO(edom)->status & SEDF_ASLEEP)) -static void sedf_dump_cpu_state(struct scheduler *ops, int i); +static void sedf_dump_cpu_state(const struct scheduler *ops, int i); static inline int extraq_on(struct vcpu *d, int i) { @@ -332,7 +332,7 @@ static inline void __add_to_runqueue_sor } -static void *sedf_alloc_vdata(struct scheduler *ops, struct vcpu *v, void *dd) +static void *sedf_alloc_vdata(const struct scheduler *ops, struct vcpu *v, void *dd) { struct sedf_vcpu_info *inf; @@ -381,7 +381,7 @@ static void *sedf_alloc_vdata(struct sch } static void * -sedf_alloc_pdata(struct scheduler *ops, int cpu) +sedf_alloc_pdata(const struct scheduler *ops, int cpu) { struct sedf_cpu_info *spc; @@ -397,7 +397,7 @@ sedf_alloc_pdata(struct scheduler *ops, } static void -sedf_free_pdata(struct scheduler *ops, void *spc, int cpu) +sedf_free_pdata(const struct scheduler *ops, void *spc, int cpu) { if ( spc == NULL ) return; @@ -405,18 +405,18 @@ sedf_free_pdata(struct scheduler *ops, v xfree(spc); } -static void sedf_free_vdata(struct scheduler *ops, void *priv) +static void sedf_free_vdata(const struct scheduler *ops, void *priv) { xfree(priv); } -static void sedf_destroy_vcpu(struct scheduler *ops, struct vcpu *v) +static void sedf_destroy_vcpu(const struct scheduler *ops, struct vcpu *v) { sedf_free_vdata(ops, v->sched_priv); } static void * -sedf_alloc_domdata(struct scheduler *ops, struct domain *d) +sedf_alloc_domdata(const struct scheduler *ops, struct domain *d) { void *mem; @@ -429,7 +429,7 @@ sedf_alloc_domdata(struct scheduler *ops return mem; } -static int sedf_init_domain(struct scheduler *ops, struct domain *d) +static int sedf_init_domain(const struct scheduler *ops, struct domain *d) { d->sched_priv = sedf_alloc_domdata(ops, d); if ( d->sched_priv == NULL ) @@ -438,17 +438,17 @@ static int sedf_init_domain(struct sched return 0; } -static void sedf_free_domdata(struct scheduler *ops, void *data) +static void sedf_free_domdata(const struct scheduler *ops, void *data) { xfree(data); } -static void sedf_destroy_domain(struct scheduler *ops, struct domain *d) +static void sedf_destroy_domain(const struct scheduler *ops, struct domain *d) { sedf_free_domdata(ops, d->sched_priv); } -static int sedf_pick_cpu(struct scheduler *ops, struct vcpu *v) +static int sedf_pick_cpu(const struct scheduler *ops, struct vcpu *v) { cpumask_t online_affinity; cpumask_t *online; @@ -790,7 +790,7 @@ static struct task_slice sedf_do_extra_s -timeslice for the current period used up -domain on waitqueue has started it's period -and various others ;) in general: determine which domain to run next*/ -static struct task_slice sedf_do_schedule(struct scheduler *ops, s_time_t now) +static struct task_slice sedf_do_schedule(const struct scheduler *ops, s_time_t now) { int cpu = smp_processor_id(); struct list_head *runq = RUNQ(cpu); @@ -888,7 +888,7 @@ static struct task_slice sedf_do_schedul } -static void sedf_sleep(struct scheduler *ops, struct vcpu *d) +static void sedf_sleep(const struct scheduler *ops, struct vcpu *d) { PRINT(2,"sedf_sleep was called, domain-id %i.%i\n", d->domain->domain_id, d->vcpu_id); @@ -1107,7 +1107,7 @@ static inline int should_switch(struct v return 1; } -static void sedf_wake(struct scheduler *ops, struct vcpu *d) +static void sedf_wake(const struct scheduler *ops, struct vcpu *d) { s_time_t now = NOW(); struct sedf_vcpu_info* inf = EDOM_INFO(d); @@ -1261,7 +1261,7 @@ static void sedf_dump_domain(struct vcpu /* dumps all domains on the specified cpu */ -static void sedf_dump_cpu_state(struct scheduler *ops, int i) +static void sedf_dump_cpu_state(const struct scheduler *ops, int i) { struct list_head *list, *queue, *tmp; struct sedf_vcpu_info *d_inf; @@ -1408,7 +1408,7 @@ static int sedf_adjust_weights(struct cp /* set or fetch domain scheduling parameters */ -static int sedf_adjust(struct scheduler *ops, struct domain *p, struct xen_domctl_scheduler_op *op) +static int sedf_adjust(const struct scheduler *ops, struct domain *p, struct xen_domctl_scheduler_op *op) { struct vcpu *v; int rc; @@ -1495,7 +1495,7 @@ static int sedf_adjust(struct scheduler return 0; } -struct scheduler sched_sedf_def = { +const struct scheduler sched_sedf_def = { .name = "Simple EDF Scheduler", .opt_name = "sedf", .sched_id = XEN_SCHEDULER_SEDF, diff -r a455cae31549 -r df8c580b523a xen/include/xen/sched-if.h --- a/xen/include/xen/sched-if.h Tue May 04 22:20:05 2010 +0100 +++ b/xen/include/xen/sched-if.h Tue May 04 22:42:34 2010 +0100 @@ -90,36 +90,38 @@ struct scheduler { void *sched_data; /* global data pointer */ int (*init) (struct scheduler *, int); - void (*deinit) (struct scheduler *); + void (*deinit) (const struct scheduler *); - void (*free_vdata) (struct scheduler *, void *); - void * (*alloc_vdata) (struct scheduler *, struct vcpu *, + void (*free_vdata) (const struct scheduler *, void *); + void * (*alloc_vdata) (const struct scheduler *, struct vcpu *, void *); - void (*free_pdata) (struct scheduler *, void *, int); - void * (*alloc_pdata) (struct scheduler *, int); - void (*free_domdata) (struct scheduler *, void *); - void * (*alloc_domdata) (struct scheduler *, struct domain *); + void (*free_pdata) (const struct scheduler *, void *, int); + void * (*alloc_pdata) (const struct scheduler *, int); + void (*free_domdata) (const struct scheduler *, void *); + void * (*alloc_domdata) (const struct scheduler *, struct domain *); - int (*init_domain) (struct scheduler *, struct domain *); - void (*destroy_domain) (struct scheduler *, struct domain *); + int (*init_domain) (const struct scheduler *, struct domain *); + void (*destroy_domain) (const struct scheduler *, struct domain *); - void (*insert_vcpu) (struct scheduler *, struct vcpu *); - void (*destroy_vcpu) (struct scheduler *, struct vcpu *); + void (*insert_vcpu) (const struct scheduler *, struct vcpu *); + void (*destroy_vcpu) (const struct scheduler *, struct vcpu *); - void (*sleep) (struct scheduler *, struct vcpu *); - void (*wake) (struct scheduler *, struct vcpu *); - void (*context_saved) (struct scheduler *, struct vcpu *); + void (*sleep) (const struct scheduler *, struct vcpu *); + void (*wake) (const struct scheduler *, struct vcpu *); + void (*context_saved) (const struct scheduler *, struct vcpu *); - struct task_slice (*do_schedule) (struct scheduler *, s_time_t); + struct task_slice (*do_schedule) (const struct scheduler *, s_time_t); - int (*pick_cpu) (struct scheduler *, struct vcpu *); - int (*adjust) (struct scheduler *, struct domain *, + int (*pick_cpu) (const struct scheduler *, struct vcpu *); + int (*adjust) (const struct scheduler *, struct domain *, struct xen_domctl_scheduler_op *); - void (*dump_settings) (struct scheduler *); - void (*dump_cpu_state) (struct scheduler *, int); + int (*adjust_global) (const struct scheduler *, + struct xen_sysctl_scheduler_op *); + void (*dump_settings) (const struct scheduler *); + void (*dump_cpu_state) (const struct scheduler *, int); - void (*tick_suspend) (struct scheduler *, unsigned int); - void (*tick_resume) (struct scheduler *, unsigned int); + void (*tick_suspend) (const struct scheduler *, unsigned int); + void (*tick_resume) (const struct scheduler *, unsigned int); }; struct cpupool _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |