summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorSyed Rameez Mustafa <rameezmustafa@codeaurora.org>2014-09-04 16:24:42 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:00:38 -0700
commit759ea992364e927f90964ea8a044c07afffe0e60 (patch)
tree0fa48007b9f7f6078c84b867e4b23074cb35837b /kernel
parent3dcd52ded0d4884ab58add896f3dab97b02e6a70 (diff)
sched: window-stats: add a new AVG policy
The current WINDOW_STATS_AVG policy is actually a misnomer since it uses the maximum value of the runtime in the recent window and the average of the past ravg_hist_size windows. Add a policy that only uses the average and call it WINDOW_STATS_AVG policy. Rename all the other polices to make them shorter and unambiguous. Change-Id: I080a4ea072a84a88858ca9da59a4151dfbdbe62c Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/core.c10
-rw-r--r--kernel/sched/sched.h9
2 files changed, 11 insertions, 8 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 658f0623c78f..7fd3c2a0ccbe 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1176,9 +1176,9 @@ __read_mostly unsigned int sysctl_sched_ravg_hist_size = 5;
static __read_mostly unsigned int sched_window_stats_policy =
- WINDOW_STATS_USE_AVG;
+ WINDOW_STATS_MAX_RECENT_AVG;
__read_mostly unsigned int sysctl_sched_window_stats_policy =
- WINDOW_STATS_USE_AVG;
+ WINDOW_STATS_MAX_RECENT_AVG;
static __read_mostly unsigned int sched_account_wait_time = 1;
__read_mostly unsigned int sysctl_sched_account_wait_time = 1;
@@ -1332,10 +1332,12 @@ update_history(struct rq *rq, struct task_struct *p, u32 runtime, int samples,
compute_demand:
avg = div64_u64(sum, sched_ravg_hist_size);
- if (sched_window_stats_policy == WINDOW_STATS_USE_RECENT)
+ if (sched_window_stats_policy == WINDOW_STATS_RECENT)
demand = runtime;
- else if (sched_window_stats_policy == WINDOW_STATS_USE_MAX)
+ else if (sched_window_stats_policy == WINDOW_STATS_MAX)
demand = max;
+ else if (sched_window_stats_policy == WINDOW_STATS_AVG)
+ demand = avg;
else
demand = max(avg, runtime);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 1fb0d898f66b..9958361c27c1 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -943,10 +943,11 @@ extern void init_new_task_load(struct task_struct *p);
#if defined(CONFIG_SCHED_FREQ_INPUT) || defined(CONFIG_SCHED_HMP)
-#define WINDOW_STATS_USE_RECENT 0
-#define WINDOW_STATS_USE_MAX 1
-#define WINDOW_STATS_USE_AVG 2
-#define WINDOW_STATS_INVALID_POLICY 3
+#define WINDOW_STATS_RECENT 0
+#define WINDOW_STATS_MAX 1
+#define WINDOW_STATS_MAX_RECENT_AVG 2
+#define WINDOW_STATS_AVG 3
+#define WINDOW_STATS_INVALID_POLICY 4
extern struct mutex policy_mutex;
extern unsigned int sched_ravg_window;