From 759ea992364e927f90964ea8a044c07afffe0e60 Mon Sep 17 00:00:00 2001 From: Syed Rameez Mustafa Date: Thu, 4 Sep 2014 16:24:42 -0700 Subject: 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 --- kernel/sched/core.c | 10 ++++++---- kernel/sched/sched.h | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'kernel') 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; -- cgit v1.2.3