rtmutex: Detect changes in the pi lock chain
[platform/adaptation/renesas_rcar/renesas_kernel.git] / kernel / sched / deadline.c
index aecf930..ce85264 100644 (file)
@@ -490,9 +490,17 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer)
                                                     struct sched_dl_entity,
                                                     dl_timer);
        struct task_struct *p = dl_task_of(dl_se);
-       struct rq *rq = task_rq(p);
+       struct rq *rq;
+again:
+       rq = task_rq(p);
        raw_spin_lock(&rq->lock);
 
+       if (rq != task_rq(p)) {
+               /* Task was moved, retrying. */
+               raw_spin_unlock(&rq->lock);
+               goto again;
+       }
+
        /*
         * We need to take care of a possible races here. In fact, the
         * task might have changed its scheduling policy to something
@@ -562,6 +570,8 @@ int dl_runtime_exceeded(struct rq *rq, struct sched_dl_entity *dl_se)
        return 1;
 }
 
+extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq);
+
 /*
  * Update the current task's runtime statistics (provided it is still
  * a -deadline task and has not been removed from the dl_rq).
@@ -625,11 +635,13 @@ static void update_curr_dl(struct rq *rq)
                struct rt_rq *rt_rq = &rq->rt;
 
                raw_spin_lock(&rt_rq->rt_runtime_lock);
-               rt_rq->rt_time += delta_exec;
                /*
                 * We'll let actual RT tasks worry about the overflow here, we
-                * have our own CBS to keep us inline -- see above.
+                * have our own CBS to keep us inline; only account when RT
+                * bandwidth is relevant.
                 */
+               if (sched_rt_bandwidth_account(rt_rq))
+                       rt_rq->rt_time += delta_exec;
                raw_spin_unlock(&rt_rq->rt_runtime_lock);
        }
 }