Re: [RFC PATCH] sched: Reduce overestimating avg_idle
From: Rik van Riel
Date: Wed Jul 31 2013 - 12:01:40 EST
On 07/31/2013 05:37 AM, Jason Low wrote:
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index e8b3350..62b484b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1341,12 +1341,12 @@ ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags)
if (rq->idle_stamp) {
u64 delta = rq->clock - rq->idle_stamp;
- u64 max = 2*sysctl_sched_migration_cost;
+ u64 max = (sysctl_sched_migration_cost * 3) / 2;
- 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;
}
I wonder if we could get even more conservative values
of avg_idle by clamping delta to max, before calling
update_avg...
Or rather, I wonder if that would matter enough to make
a difference, and in what direction that difference would
be.
In other words:
if (rq->idle_stamp) {
u64 delta = rq->clock - rq->idle_stamp;
u64 max = (sysctl_sched_migration_cost * 3) / 2;
if (delta > max)
delta = max;
update_avg(&rq->avg_idle, delta);
rq->idle_stamp = 0;
}
--
All rights reversed
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/