drm/i915: handle non-flip pending case when unpinning the scanout buffer
[safe/jmp/linux-2.6] / kernel / sched.c
index 7ffde2a..4508fe7 100644 (file)
@@ -2045,11 +2045,10 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
 
        trace_sched_migrate_task(p, new_cpu);
 
-       if (task_cpu(p) == new_cpu)
-               return;
-
-       p->se.nr_migrations++;
-       perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 1, NULL, 0);
+       if (task_cpu(p) != new_cpu) {
+               p->se.nr_migrations++;
+               perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 1, NULL, 0);
+       }
 
        __set_task_cpu(p, new_cpu);
 }
@@ -2346,7 +2345,7 @@ int select_task_rq(struct task_struct *p, int sd_flags, int wake_flags)
         *   not worry about this generic constraint ]
         */
        if (unlikely(!cpumask_test_cpu(cpu, &p->cpus_allowed) ||
-                    !cpu_active(cpu)))
+                    !cpu_online(cpu)))
                cpu = select_fallback_rq(task_cpu(p), p);
 
        return cpu;
@@ -5531,8 +5530,11 @@ need_resched_nonpreemptible:
 
        post_schedule(rq);
 
-       if (unlikely(reacquire_kernel_lock(current) < 0))
+       if (unlikely(reacquire_kernel_lock(current) < 0)) {
+               prev = rq->curr;
+               switch_count = &prev->nivcsw;
                goto need_resched_nonpreemptible;
+       }
 
        preempt_enable_no_resched();
        if (need_resched())