aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/schedule.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2011-04-02 15:57:03 +0100
committerJan Beulich <jbeulich@novell.com>2011-04-02 15:57:03 +0100
commitd5298187b30d5806deda9088828fd29cad9237da (patch)
treed5306b6c7072fe95344f05751966a2ff60cf8abb /xen/common/schedule.c
parent06490f43250dddc40b4aaf0ff4995991f94e170a (diff)
downloadxen-d5298187b30d5806deda9088828fd29cad9237da.tar.gz
xen-d5298187b30d5806deda9088828fd29cad9237da.tar.bz2
xen-d5298187b30d5806deda9088828fd29cad9237da.zip
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 <jbeulich@novell.com>
Diffstat (limited to 'xen/common/schedule.c')
-rw-r--r--xen/common/schedule.c25
1 files changed, 16 insertions, 9 deletions
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;