xen/common/schedule.c

  1.  /* Initialise the data structures. */
  2.  void __init scheduler_init(void)
  3.  {
  4.   int i;
  5.  
  6.   open_softirq(SCHEDULE_SOFTIRQ, schedule);
  7.  
  8.   for_each_cpu ( i )
  9.   {
  10.   spin_lock_init(&per_cpu(schedule_data, i).schedule_lock);
  11.   init_timer(&per_cpu(schedule_data, i).s_timer, s_timer_fn, NULL, i);
  12.   }
  13.  
  14.   for ( i = 0; schedulers[i] != NULL; i++ )
  15.   {
  16.   ops = *schedulers[i];
  17.   if ( strcmp(ops.opt_name, opt_sched) == 0 )
  18.   break;
  19.   }
  20.  
  21.   if ( schedulers[i] == NULL )
  22.   printk("Could not find scheduler: %s\n", opt_sched);
  23.  
  24.   printk("Using scheduler: %s (%s)\n", ops.name, ops.opt_name);
  25.   SCHED_OP(init); //执行ops.init() 默认为sched_credit_def.csched_init()
  26.  }