From d5298187b30d5806deda9088828fd29cad9237da Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Sat, 2 Apr 2011 15:57:03 +0100 Subject: move register_cpu_notifier() into .init.text With no modular drivers, all CPU notifier setup is supposed to happen during boot. There also is a respective comment in the function.=20 Signed-off-by: Jan Beulich --- xen/common/schedule.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'xen/common/schedule.c') diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 129abe44e4..5efb822a81 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -66,7 +66,6 @@ static const struct scheduler *schedulers[] = { &sched_credit_def, &sched_credit2_def, &sched_arinc653_def, - NULL }; static struct scheduler __read_mostly ops; @@ -1324,17 +1323,25 @@ void __init scheduler_init(void) open_softirq(SCHEDULE_SOFTIRQ, schedule); - for ( i = 0; schedulers[i] != NULL; i++ ) + for ( i = 0; i < ARRAY_SIZE(schedulers); i++ ) { - ops = *schedulers[i]; - if ( strcmp(ops.opt_name, opt_sched) == 0 ) - break; + if ( schedulers[i]->global_init && schedulers[i]->global_init() < 0 ) + schedulers[i] = NULL; + else if ( !ops.name && !strcmp(schedulers[i]->opt_name, opt_sched) ) + ops = *schedulers[i]; } - if ( schedulers[i] == NULL ) + if ( !ops.name ) { printk("Could not find scheduler: %s\n", opt_sched); - ops = *schedulers[0]; + for ( i = 0; i < ARRAY_SIZE(schedulers); i++ ) + if ( schedulers[i] ) + { + ops = *schedulers[i]; + break; + } + BUG_ON(!ops.name); + printk("Using '%s' (%s)\n", ops.name, ops.opt_name); } if ( cpu_schedule_up(0) ) @@ -1407,8 +1414,8 @@ struct scheduler *scheduler_alloc(unsigned int sched_id, int *perr) int i; struct scheduler *sched; - for ( i = 0; schedulers[i] != NULL; i++ ) - if ( schedulers[i]->sched_id == sched_id ) + for ( i = 0; i < ARRAY_SIZE(schedulers); i++ ) + if ( schedulers[i] && schedulers[i]->sched_id == sched_id ) goto found; *perr = -ENOENT; return NULL; -- cgit v1.2.3