sched/deadline: Fix comment in enqueue_task_dl()
[cascardo/linux.git] / kernel / sched / deadline.c
index 0a17af3..fc8f010 100644 (file)
@@ -953,7 +953,7 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
 
        /*
         * Use the scheduling parameters of the top pi-waiter
-        * task if we have one and its (relative) deadline is
+        * task if we have one and its (absolute) deadline is
         * smaller than our one... OTW we keep our runtime and
         * deadline.
         */
@@ -1563,7 +1563,7 @@ out:
 
 static void push_dl_tasks(struct rq *rq)
 {
-       /* Terminates as it moves a -deadline task */
+       /* push_dl_task() will return true if it moved a -deadline task */
        while (push_dl_task(rq))
                ;
 }
@@ -1657,7 +1657,6 @@ static void task_woken_dl(struct rq *rq, struct task_struct *p)
 {
        if (!task_running(rq, p) &&
            !test_tsk_need_resched(rq->curr) &&
-           has_pushable_dl_tasks(rq) &&
            p->nr_cpus_allowed > 1 &&
            dl_task(rq->curr) &&
            (rq->curr->nr_cpus_allowed < 2 ||
@@ -1669,9 +1668,8 @@ static void task_woken_dl(struct rq *rq, struct task_struct *p)
 static void set_cpus_allowed_dl(struct task_struct *p,
                                const struct cpumask *new_mask)
 {
-       struct rq *rq;
        struct root_domain *src_rd;
-       int weight;
+       struct rq *rq;
 
        BUG_ON(!dl_task(p));
 
@@ -1697,37 +1695,7 @@ static void set_cpus_allowed_dl(struct task_struct *p,
                raw_spin_unlock(&src_dl_b->lock);
        }
 
-       /*
-        * Update only if the task is actually running (i.e.,
-        * it is on the rq AND it is not throttled).
-        */
-       if (!on_dl_rq(&p->dl))
-               return;
-
-       weight = cpumask_weight(new_mask);
-
-       /*
-        * Only update if the process changes its state from whether it
-        * can migrate or not.
-        */
-       if ((p->nr_cpus_allowed > 1) == (weight > 1))
-               return;
-
-       /*
-        * The process used to be able to migrate OR it can now migrate
-        */
-       if (weight <= 1) {
-               if (!task_current(rq, p))
-                       dequeue_pushable_dl_task(rq, p);
-               BUG_ON(!rq->dl.dl_nr_migratory);
-               rq->dl.dl_nr_migratory--;
-       } else {
-               if (!task_current(rq, p))
-                       enqueue_pushable_dl_task(rq, p);
-               rq->dl.dl_nr_migratory++;
-       }
-
-       update_dl_migration(&rq->dl);
+       set_cpus_allowed_common(p, new_mask);
 }
 
 /* Assumes rq->lock is held */