sched/pelt: Fix false running accounting
[linux-2.6-microblaze.git] / kernel / sched / fair.c
index 75c58c7..ef5b66b 100644 (file)
@@ -2990,6 +2990,18 @@ ___update_load_avg(u64 now, int cpu, struct sched_avg *sa,
 
        sa->last_update_time += delta << 10;
 
+       /*
+        * running is a subset of runnable (weight) so running can't be set if
+        * runnable is clear. But there are some corner cases where the current
+        * se has been already dequeued but cfs_rq->curr still points to it.
+        * This means that weight will be 0 but not running for a sched_entity
+        * but also for a cfs_rq if the latter becomes idle. As an example,
+        * this happens during idle_balance() which calls
+        * update_blocked_averages()
+        */
+       if (!weight)
+               running = 0;
+
        /*
         * Now we know we crossed measurement unit boundaries. The *_avg
         * accrues by two steps: