]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
sched: Reduce overestimating rq->avg_idle
authorJason Low <jason.low2@hp.com>
Fri, 13 Sep 2013 18:26:51 +0000 (11:26 -0700)
committerIngo Molnar <mingo@kernel.org>
Fri, 20 Sep 2013 10:03:41 +0000 (12:03 +0200)
When updating avg_idle, if the delta exceeds some max value, then avg_idle
gets set to the max, regardless of what the previous avg was. This can cause
avg_idle to often be overestimated.

This patch modifies the way we update avg_idle by always updating it with the
function call to update_avg() first. Then, if avg_idle exceeds the max, we set
it to the max.

Signed-off-by: Jason Low <jason.low2@hp.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1379096813-3032-2-git-send-email-jason.low2@hp.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/core.c

index 5ac63c9a995a3570e0ad73a20b28c23cb972a963..048f39e457611dd687a6e6c7b2a06ce8d2fcb59b 100644 (file)
@@ -1332,10 +1332,11 @@ ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags)
                u64 delta = rq_clock(rq) - rq->idle_stamp;
                u64 max = 2*sysctl_sched_migration_cost;
 
-               if (delta > max)
+               update_avg(&rq->avg_idle, delta);
+
+               if (rq->avg_idle > max)
                        rq->avg_idle = max;
-               else
-                       update_avg(&rq->avg_idle, delta);
+
                rq->idle_stamp = 0;
        }
 #endif