天下网吧 >> 网吧天地 >> 网吧技术 >> 网吧系统 >> 正文

详解Linux系统内核抢占补丁的相关原理

2013-2-26不详佚名

68239">

  prev = current;

  this_CPU = prev->processor;

  if (in_interrupt())

  goto scheduling_in_interrupt;

  release_kernel_lock(prev, this_CPU);

  /* Do "administrative" work here while we don't hold any locks */

  if (softirq_active(this_cpu) & softirq_mask(this_CPU))

  goto handle_softirq;

  handle_softirq_back:

  /*

  * 'sched_data' is protected by the fact that we can run

  * only one process per CPU.

  */

  sched_data = & aligned_data[this_CPU].schedule_data;

  spin_lock_irq(&runqueue_lock);

  /* move an exhausted RR process to be last.. */

  if (prev->policy == SCHED_RR)

  goto move_rr_last;

  move_rr_back:

  switch (prev->state) {

  case TASK_INTERRUPTIBLE:

  if (signal_pending(prev)) {

  prev->state = TASK_RUNNING;

  break;

  }

  default:

  #ifdef CONFIG_PREEMPT

  if (prev->state & TASK_PREEMPTED)

  break; 如果是内核抢占调度,则保留运行队列

  #endif

  del_from_runqueue(prev);

  #ifdef CONFIG_PREEMPT

  case TASK_PREEMPTED:

  #endif

  case TASK_RUNNING:

  }

  prev->need_resched = 0;

  /*

  * this is the scheduler proper:

  */

  repeat_schedule:

  /*

  * Default process to select..

  */

  next = idle_task(this_CPU);

  c = -1000;

  if (task_on_runqueue(prev))

  goto still_running;

  still_running_back:

  list_for_each(tmp, &runqueue_head) {

  p = list_entry(tmp, struct task_struct, run_list);

  if (can_schedule(p, this_CPU)) {

  int weight = goodness(p, this_CPU, prev->active_mm);

  if (weight > c)


本文来源:不详 作者:佚名

声明
声明:本站所发表的文章、评论及图片仅代表作者本人观点,与本站立场无关。若文章侵犯了您的相关权益,请及时与我们联系,我们会及时处理,感谢您对本站的支持!联系email:support@txwb.com,系统开号,技术支持,服务联系QQ:1175525021本站所有有注明来源为天下网吧或天下网吧论坛的原创作品,各位转载时请注明来源链接!
天下网吧·网吧天下
  • 本周热门
  • 本月热门
  • 阅读排行