Ejemplo n.º 1
0
static struct task_struct *pick_next_task_dummy(struct rq *rq)
{
  
  struct dummy_rq *dummy_rq = &rq->dummy;
  struct sched_dummy_entity *next;
  int i = 0;
  
  /* The queues are browsed ordered by priority. It returns as soon as a nonempty queue is found. */
  for (i = 0; i < NR_PRIO_LEVELS; ++i) {
    struct list_head *queue = &(dummy_rq->queues[i]);
    if (!list_empty(queue)) {
      next = list_first_entry(queue, struct sched_dummy_entity, run_list);
      
      /* Imagine the following case: a process of the highest priority handled by this sched class
       * is running while a process of higher priority preempts that process and is handled by another
       * sched class. Suppose this happens frequently. To make sure that the same process does not
       * run a fraction of a round robin quantum and that the other processes in the queue gets their
       * cycle we reset the round robin counter here only when a process has completed a round robin
       * tour.
      */
      if (rq->curr->dummy_se.rr_tick_count >= get_timeslice()) {
	rq->curr->dummy_se.rr_tick_count = 0;
      }

      return dummy_task_of(next);
    }
  
  }
Ejemplo n.º 2
0
static struct task_struct *pick_next_task_dummy(struct rq *rq)
{
	struct dummy_rq *dummy_rq = &rq->dummy;
	struct sched_dummy_entity *next;
	int i;
	for(i = 0; i < 5; i++) {
		if (!list_empty(&dummy_rq->queues[i])) {
			next = list_first_entry(&dummy_rq->queues[i], struct sched_dummy_entity, run_list);
			printk(KERN_CRIT "pick_next: %d\n",rq->curr->pid);
			return dummy_task_of(next);
		}
	}