summaryrefslogtreecommitdiff
path: root/kernel/sched/stop_task.c
diff options
context:
space:
mode:
authorPavankumar Kondeti <pkondeti@codeaurora.org>2015-06-08 09:08:47 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:25:17 -0700
commit6d742ce87b0337f422edf9c114357758e6feb01f (patch)
tree6169cd473bc056ec6b8bfa60972f1ddb25ba4260 /kernel/sched/stop_task.c
parentefa673322fd6917acb69361fc01f746a13b3fcde (diff)
sched: Add separate load tracking histogram to predict loads
Current window based load tracking only saves history for five windows. A historically heavy task's heavy load will be completely forgotten after five windows of light load. Even before the five window expires, a heavy task wakes up on same CPU it used to run won't trigger any frequency change until end of the window. It would starve for the entire window. It also adds one "small" load window to history because it's accumulating load at a low frequency, further reducing the tracked load for this heavy task. Ideally, scheduler should be able to identify such tasks and notify governor to increase frequency immediately after it wakes up. Add a histogram for each task to track a much longer load history. A prediction will be made based on runtime of previous or current window, histogram data and load tracked in recent windows. Prediction of all tasks that is currently running or runnable on a CPU is aggregated and reported to CPUFreq governor in sched_get_cpus_busy(). sched_get_cpus_busy() now returns predicted busy time in addition to previous window busy time and new task busy time, scaled to the CPU maximum possible frequency. Tunables: - /proc/sys/kernel/sched_gov_alert_freq (KHz) This tunable can be used to further filter the notifications. Frequency alert notification is sent only when the predicted load exceeds previous window load by sched_gov_alert_freq converted to load. Change-Id: If29098cd2c5499163ceaff18668639db76ee8504 Suggested-by: Saravana Kannan <skannan@codeaurora.org> Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org> Signed-off-by: Junjie Wu <junjiew@codeaurora.org> [joonwoop@codeaurora.org: fixed merge conflicts around __migrate_task() and removed changes for CONFIG_SCHED_QHMP.]
Diffstat (limited to 'kernel/sched/stop_task.c')
-rw-r--r--kernel/sched/stop_task.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/sched/stop_task.c b/kernel/sched/stop_task.c
index 1918c46ccca9..134da1cc8fce 100644
--- a/kernel/sched/stop_task.c
+++ b/kernel/sched/stop_task.c
@@ -33,11 +33,13 @@ dec_hmp_sched_stats_stop(struct rq *rq, struct task_struct *p)
static void
fixup_hmp_sched_stats_stop(struct rq *rq, struct task_struct *p,
- u32 new_task_load)
+ u32 new_task_load, u32 new_pred_demand)
{
s64 task_load_delta = (s64)new_task_load - task_load(p);
+ s64 pred_demand_delta = PRED_DEMAND_DELTA;
- fixup_cumulative_runnable_avg(&rq->hmp_stats, p, task_load_delta);
+ fixup_cumulative_runnable_avg(&rq->hmp_stats, p, task_load_delta,
+ pred_demand_delta);
}
#else /* CONFIG_SCHED_HMP */