From ef3ba55b554aebfe30ba8d5dfb8b3d6affee13e2 Mon Sep 17 00:00:00 2001 From: Shaleen Agrawal Date: Wed, 9 Feb 2022 14:09:30 -0800 Subject: [PATCH] sched: walt: Remove finding historical runtimes in pred When determining predictive demand, we currently look at the history samples in our past 8 windows that fall under the bucket range for which we are evaluating. However, this level of precision is not required, and can be dropped in favor of reduction of overheads. Change-Id: Icef5d23b1574c625ef1a6d6228603d2b18aa8a40 Signed-off-by: Shaleen Agrawal --- kernel/sched/walt/walt.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/kernel/sched/walt/walt.c b/kernel/sched/walt/walt.c index 4270d0d3d4c7..649857de467d 100644 --- a/kernel/sched/walt/walt.c +++ b/kernel/sched/walt/walt.c @@ -1188,9 +1188,7 @@ static inline int busy_to_bucket(u32 normalized_rt) * A new predicted busy time is returned for task @p based on @runtime * passed in. The function searches through buckets that represent busy * time equal to or bigger than @runtime and attempts to find the bucket - * to use for prediction. Once found, it searches through historical busy - * time and returns the latest that falls into the bucket. If no such busy - * time exists, it returns the medium of that bucket. + * to use for prediction. Once found, it returns the midpoint of that bucket. */ static u32 get_pred_busy(struct task_struct *p, int start, u32 runtime) @@ -1198,7 +1196,6 @@ static u32 get_pred_busy(struct task_struct *p, int i; struct walt_task_struct *wts = (struct walt_task_struct *) p->android_vendor_data1; u8 *buckets = wts->busy_buckets; - u32 *hist = wts->sum_history; u32 dmin, dmax; u64 cur_freq_runtime = 0; int first = NUM_BUSY_BUCKETS, final; @@ -1232,24 +1229,11 @@ static u32 get_pred_busy(struct task_struct *p, } dmax = mult_frac(final + 1, max_task_load(), NUM_BUSY_BUCKETS); - /* - * search through runtime history and return first runtime that falls - * into the range of predicted bucket. - */ - for (i = 0; i < sched_ravg_hist_size; i++) { - if (hist[i] >= dmin && hist[i] < dmax) { - ret = hist[i]; - break; - } - } - /* no historical runtime within bucket found, use average of the bin */ - if (ret < dmin) - ret = (dmin + dmax) / 2; /* * when updating in middle of a window, runtime could be higher * than all recorded history. Always predict at least runtime. */ - ret = max(runtime, ret); + ret = max(runtime, (dmin + dmax) / 2); out: trace_sched_update_pred_demand(p, runtime, mult_frac((unsigned int)cur_freq_runtime, 100,