Merge tag 'pinctrl-v3.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[cascardo/linux.git] / kernel / sched / rt.c
index 20bca39..ee15f5a 100644 (file)
@@ -1301,9 +1301,6 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags)
        struct task_struct *curr;
        struct rq *rq;
 
-       if (p->nr_cpus_allowed == 1)
-               goto out;
-
        /* For anything but wake ups, just return the task_cpu */
        if (sd_flag != SD_BALANCE_WAKE && sd_flag != SD_BALANCE_FORK)
                goto out;
@@ -1351,16 +1348,22 @@ out:
 
 static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
 {
-       if (rq->curr->nr_cpus_allowed == 1)
+       /*
+        * Current can't be migrated, useless to reschedule,
+        * let's hope p can move out.
+        */
+       if (rq->curr->nr_cpus_allowed == 1 ||
+           !cpupri_find(&rq->rd->cpupri, rq->curr, NULL))
                return;
 
+       /*
+        * p is migratable, so let's not schedule it and
+        * see if it is pushed or pulled somewhere else.
+        */
        if (p->nr_cpus_allowed != 1
            && cpupri_find(&rq->rd->cpupri, p, NULL))
                return;
 
-       if (!cpupri_find(&rq->rd->cpupri, rq->curr, NULL))
-               return;
-
        /*
         * There appears to be other cpus that can accept
         * current and none to run 'p', so lets reschedule