sched: fix ideal_runtime calculations for reniced tasks
[powerpc.git] / kernel / sched_rt.c
index fa5a462..4b87476 100644 (file)
@@ -25,8 +25,7 @@ static inline void update_curr_rt(struct rq *rq)
        curr->se.exec_start = rq->clock;
 }
 
-static void
-enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup, u64 now)
+static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup)
 {
        struct rt_prio_array *array = &rq->rt.active;
 
@@ -37,8 +36,7 @@ enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup, u64 now)
 /*
  * Adding/removing a task to/from a priority array:
  */
-static void
-dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep, u64 now)
+static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep)
 {
        struct rt_prio_array *array = &rq->rt.active;
 
@@ -75,7 +73,7 @@ static void check_preempt_curr_rt(struct rq *rq, struct task_struct *p)
                resched_task(rq->curr);
 }
 
-static struct task_struct *pick_next_task_rt(struct rq *rq, u64 now)
+static struct task_struct *pick_next_task_rt(struct rq *rq)
 {
        struct rt_prio_array *array = &rq->rt.active;
        struct task_struct *next;
@@ -94,7 +92,7 @@ static struct task_struct *pick_next_task_rt(struct rq *rq, u64 now)
        return next;
 }
 
-static void put_prev_task_rt(struct rq *rq, struct task_struct *p, u64 now)
+static void put_prev_task_rt(struct rq *rq, struct task_struct *p)
 {
        update_curr_rt(rq);
        p->se.exec_start = 0;
@@ -209,10 +207,15 @@ static void task_tick_rt(struct rq *rq, struct task_struct *p)
                return;
 
        p->time_slice = static_prio_timeslice(p->static_prio);
-       set_tsk_need_resched(p);
 
-       /* put it at the end of the queue: */
-       requeue_task_rt(rq, p);
+       /*
+        * Requeue to the end of queue if we are not the only element
+        * on the queue:
+        */
+       if (p->run_list.prev != p->run_list.next) {
+               requeue_task_rt(rq, p);
+               set_tsk_need_resched(p);
+       }
 }
 
 static struct sched_class rt_sched_class __read_mostly = {