summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/sched.h31
-rw-r--r--include/linux/sched/sysctl.h1
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,