diff options
| author | Srivatsa Vaddagiri <vatsa@codeaurora.org> | 2014-01-06 16:24:48 -0800 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 19:58:39 -0700 |
| commit | 74463329e4f23636cfbd126709b27395dbbfcaa7 (patch) | |
| tree | e3edd3f68ee329e31000eee855e7566a7fe3c220 /include/linux | |
| parent | 97ae7bae2cb823be587d85f3421ade6033f6f366 (diff) | |
sched: window-based load stats for tasks
Provide a metric per task that specifies how cpu bound a task is. Task
execution is monitored over several time windows and the fraction of
the window for which task was found to be executing or wanting to run
is recorded as task's demand. Windows over which task was sleeping are
ignored. We track last 5 recent windows for every task and the maximum
demand seen in any of the previous 5 windows (where task had some
activity) drives freq demand for every task.
A per-cpu metric (rq->cumulative_runnable_avg) is also provided which
is an aggregation of cpu demand of all tasks currently enqueued on it.
rq->cumulative_runnable_avg will be useful to know if cpu frequency
will need to be changed to match task demand.
Change-Id: Ib83207b9ba8683cd3304ee8a2290695c34f08fe2
Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
[rameezmustafa@codeaurora.org]: Port to msm-3.18]
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
[joonwoop@codeaurora.org: fixed conflict in ttwu_do_wakeup() to
incorporate with changed trace_sched_wakeup() location.]
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/sched.h | 31 | ||||
| -rw-r--r-- | include/linux/sched/sysctl.h | 1 |
2 files changed, 32 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index b82530481871..aa64a29d03be 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1241,8 +1241,39 @@ struct sched_statistics { }; #endif +#define RAVG_HIST_SIZE 5 + +/* ravg represents frequency scaled cpu-demand of tasks */ +struct ravg { + /* + * 'window_start' marks the beginning of new window + * + * 'mark_start' marks the beginning of an event (task waking up, task + * starting to execute, task being preempted) within a window + * + * 'sum' represents how runnable a task has been within current + * window. It incorporates both running time and wait time and is + * frequency scaled. + * + * 'sum_history' keeps track of history of 'sum' seen over previous + * RAVG_HIST_SIZE windows. Windows where task was entirely sleeping are + * ignored. + * + * 'demand' represents maximum sum seen over previous RAVG_HIST_SIZE + * windows. 'demand' could drive frequency demand for tasks. + */ + u64 window_start, mark_start; + u32 sum, demand; + u32 sum_history[RAVG_HIST_SIZE]; +}; + struct sched_entity { struct load_weight load; /* for load-balancing */ + /* + * Todo : Move ravg to 'struct task_struct', as this is common for both + * real-time and non-realtime tasks + */ + struct ravg ravg; struct rb_node run_node; struct list_head group_node; unsigned int on_rq; diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index 336290e9724e..6ae7504665ad 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h @@ -40,6 +40,7 @@ extern unsigned int sysctl_sched_min_granularity; extern unsigned int sysctl_sched_wakeup_granularity; extern unsigned int sysctl_sched_child_runs_first; extern unsigned int sysctl_sched_wake_to_idle; +extern unsigned int sysctl_sched_ravg_window; enum sched_tunable_scaling { SCHED_TUNABLESCALING_NONE, |
