[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 4/4] sched: Use the auto-generated list of schedulers
Instead of having a manually-curated list of schedulers, use the array that was auto-generated simply by compiling in the scheduler files as the sole source of truth of the available schedulers. CC: George Dunlap <george.dunlap@xxxxxxxxxxxxx> CC: Dario Faggioli <dario.faggioli@xxxxxxxxxx> Signed-off-by: Jonathan Creekmore <jonathan.creekmore@xxxxxxxxx> --- xen/common/schedule.c | 24 +++++++----------------- xen/include/xen/sched-if.h | 5 ----- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 2f98a48..efbd67d 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -64,20 +64,10 @@ static void poll_timer_fn(void *data); DEFINE_PER_CPU(struct schedule_data, schedule_data); DEFINE_PER_CPU(struct scheduler *, scheduler); -static const struct scheduler *schedulers[] = { -#ifdef CONFIG_SCHED_CREDIT - &sched_credit_def, -#endif -#ifdef CONFIG_SCHED_CREDIT2 - &sched_credit2_def, -#endif -#ifdef CONFIG_SCHED_ARINC653 - &sched_arinc653_def, -#endif -#ifdef CONFIG_SCHED_RTDS - &sched_rtds_def, -#endif -}; +extern const struct scheduler *__schedulers_start[], *__schedulers_end[]; +#define NUM_SCHEDULERS (((uintptr_t)__schedulers_end-(uintptr_t)__schedulers_start) \ + / sizeof(struct scheduler *)) +static const struct scheduler **schedulers = __schedulers_start; static struct scheduler __read_mostly ops; @@ -1468,7 +1458,7 @@ void __init scheduler_init(void) open_softirq(SCHEDULE_SOFTIRQ, schedule); - for ( i = 0; i < ARRAY_SIZE(schedulers); i++ ) + for ( i = 0; i < NUM_SCHEDULERS; i++) { if ( schedulers[i]->global_init && schedulers[i]->global_init() < 0 ) schedulers[i] = NULL; @@ -1479,7 +1469,7 @@ void __init scheduler_init(void) if ( !ops.name ) { printk("Could not find scheduler: %s\n", opt_sched); - for ( i = 0; i < ARRAY_SIZE(schedulers); i++ ) + for ( i = 0; i < NUM_SCHEDULERS; i++ ) if ( schedulers[i] ) { ops = *schedulers[i]; @@ -1599,7 +1589,7 @@ struct scheduler *scheduler_alloc(unsigned int sched_id, int *perr) int i; struct scheduler *sched; - for ( i = 0; i < ARRAY_SIZE(schedulers); i++ ) + for ( i = 0; i < NUM_SCHEDULERS; i++ ) if ( schedulers[i] && schedulers[i]->sched_id == sched_id ) goto found; *perr = -ENOENT; diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h index 9c6e0f5..66dc9c8 100644 --- a/xen/include/xen/sched-if.h +++ b/xen/include/xen/sched-if.h @@ -165,11 +165,6 @@ struct scheduler { void (*tick_resume) (const struct scheduler *, unsigned int); }; -extern const struct scheduler sched_credit_def; -extern const struct scheduler sched_credit2_def; -extern const struct scheduler sched_arinc653_def; -extern const struct scheduler sched_rtds_def; - #define REGISTER_SCHEDULER(x) static const struct scheduler *x##_entry \ __used_section(".data.schedulers") = &x; -- 2.6.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |