drm/i915: Remove redundant test in error path.
[pandora-kernel.git] / kernel / sched.c
index 700aa9a..e4bb1dd 100644 (file)
@@ -1453,7 +1453,7 @@ static int task_hot(struct task_struct *p, u64 now, struct sched_domain *sd);
 static unsigned long cpu_avg_load_per_task(int cpu)
 {
        struct rq *rq = cpu_rq(cpu);
-       unsigned long nr_running = rq->nr_running;
+       unsigned long nr_running = ACCESS_ONCE(rq->nr_running);
 
        if (nr_running)
                rq->avg_load_per_task = rq->load.weight / nr_running;
@@ -6587,7 +6587,9 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
                        req = list_entry(rq->migration_queue.next,
                                         struct migration_req, list);
                        list_del_init(&req->list);
+                       spin_unlock_irq(&rq->lock);
                        complete(&req->done);
+                       spin_lock_irq(&rq->lock);
                }
                spin_unlock_irq(&rq->lock);
                break;