sched: Fix idle_cpu()
[sfrench/cifs-2.6.git] / kernel / sched.c
index 1874c7418319d302223a9e3abed29fe581af89cc..4cdc91cf48f68cd4e3b6d80c25c3ea5fa237092e 100644 (file)
@@ -5138,7 +5138,20 @@ EXPORT_SYMBOL(task_nice);
  */
 int idle_cpu(int cpu)
 {
-       return cpu_curr(cpu) == cpu_rq(cpu)->idle;
+       struct rq *rq = cpu_rq(cpu);
+
+       if (rq->curr != rq->idle)
+               return 0;
+
+       if (rq->nr_running)
+               return 0;
+
+#ifdef CONFIG_SMP
+       if (!llist_empty(&rq->wake_list))
+               return 0;
+#endif
+
+       return 1;
 }
 
 /**