sched/dl: Fix race in dl_task_timer()
[deliverable/linux.git] / kernel / sched / deadline.c
index 800e99b99075141421d82f0bdc07e42f09baea9d..14bc348ba3b4658466e24d427a34fdbea62e6d64 100644 (file)
@@ -513,9 +513,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
This page took 0.057498 seconds and 5 git commands to generate.