sched/balancing: Periodically decay max cost of idle balance
[linux-2.6-block.git] / kernel / sched / core.c
index 5ac63c9a995a3570e0ad73a20b28c23cb972a963..c2283c54aed07a0f44b8d35cae0049e1c6ef5096 100644 (file)
@@ -1330,12 +1330,13 @@ ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags)
 
        if (rq->idle_stamp) {
                u64 delta = rq_clock(rq) - rq->idle_stamp;
-               u64 max = 2*sysctl_sched_migration_cost;
+               u64 max = 2*rq->max_idle_balance_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
@@ -6505,6 +6506,7 @@ void __init sched_init(void)
                rq->online = 0;
                rq->idle_stamp = 0;
                rq->avg_idle = 2*sysctl_sched_migration_cost;
+               rq->max_idle_balance_cost = sysctl_sched_migration_cost;
 
                INIT_LIST_HEAD(&rq->cfs_tasks);