summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorSrivatsa Vaddagiri <vatsa@codeaurora.org>2014-07-23 15:16:04 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:00:00 -0700
commitf41fd0eca9950970d7e16f4fdfa84aba77c77b19 (patch)
treef64ae6296bd741b33ba2f4e062c0dae0d8cd6c97 /kernel
parent39f974c48880622a71422c35a3b3271cd5467230 (diff)
sched: window-stats: Fix incorrect calculation of partial_demand
When using MAX_POLICY, partial_demand is calculated incorrectly as 0. Fix this by picking maximum of previous 4 windows and most recent sample. Change-Id: I27850a510746a63b5382c84761920fc021b876c5 Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/core.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d9c9f0119146..f6492a1755fc 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1204,9 +1204,14 @@ update_history(struct rq *rq, struct task_struct *p, u32 runtime, int samples,
return;
if (!new_window) {
- for (ridx = 0; ridx < RAVG_HIST_SIZE - 1; ++ridx)
+ for (ridx = 0; ridx < RAVG_HIST_SIZE - 1; ++ridx) {
sum += hist[ridx];
+ if (hist[ridx] > max)
+ max = hist[ridx];
+ }
sum += runtime;
+ if (runtime > max)
+ max = runtime;
goto compute_demand;
}