From efabb036d0068aedc9cb379eb8d2821b61f2dcfc Mon Sep 17 00:00:00 2001 From: Rishabh Bhatnagar Date: Tue, 27 Apr 2021 18:46:40 -0700 Subject: [PATCH] sched: Disable LPM if CONSERVATIVE_BOOST is enabled Disable LPM for hysteresis time if CONSERVATIVE_BOOST is enabled. Change-Id: If88513b664c00ecb2cd48961b907bec719e822a9 Signed-off-by: Rishabh Bhatnagar --- kernel/sched/walt/Kconfig | 9 +++++++++ kernel/sched/walt/sched_avg.c | 17 +++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/kernel/sched/walt/Kconfig b/kernel/sched/walt/Kconfig index b9b2422f26f0..4157dffa013c 100644 --- a/kernel/sched/walt/Kconfig +++ b/kernel/sched/walt/Kconfig @@ -29,4 +29,13 @@ config SCHED_WALT_DEBUG This module also used to crash the system to catch issues in scenarios like RT throttling and sleeping while in atomic context etc. + +config SCHED_CONSERVATIVE_BOOST_LPM_BIAS + bool "Enable LPM bias if conservative boost is enabled" + default n + help + This feature will allow the scheduler to disable low power + modes on a cpu if conservative boost is active. The cpu + will not enter low power mode for a hysteresis time period, + which can be configured from userspace. endmenu diff --git a/kernel/sched/walt/sched_avg.c b/kernel/sched/walt/sched_avg.c index 426bc30303cb..c8287e06b974 100644 --- a/kernel/sched/walt/sched_avg.c +++ b/kernel/sched/walt/sched_avg.c @@ -147,6 +147,7 @@ static inline void update_busy_hyst_end_time(int cpu, bool dequeue, u64 agg_hyst_time, total_util = 0; bool util_load_trigger = false; int i; + bool hyst_trigger, coloc_trigger; if (!per_cpu(hyst_time, cpu) && !per_cpu(coloc_hyst_time, cpu) && !per_cpu(util_hyst_time, cpu)) @@ -172,12 +173,16 @@ static inline void update_busy_hyst_end_time(int cpu, bool dequeue, } } - agg_hyst_time = max(max((nr_run_trigger || load_trigger) ? - per_cpu(hyst_time, cpu) : 0, - (nr_run_trigger || coloc_load_trigger) ? - per_cpu(coloc_hyst_time, cpu) : 0), - (util_load_trigger) ? - per_cpu(util_hyst_time, cpu) : 0); + coloc_trigger = nr_run_trigger || coloc_load_trigger; +#ifdef CONFIG_SCHED_CONSERVATIVE_BOOST_LPM_BIAS + hyst_trigger = nr_run_trigger || load_trigger || (sched_boost_type == CONSERVATIVE_BOOST); +#else + hyst_trigger = nr_run_trigger || load_trigger; +#endif + + agg_hyst_time = max(max(hyst_trigger ? per_cpu(hyst_time, cpu) : 0, + coloc_trigger ? per_cpu(coloc_hyst_time, cpu) : 0), + util_load_trigger ? per_cpu(util_hyst_time, cpu) : 0); if (agg_hyst_time) { atomic64_set(&per_cpu(busy_hyst_end_time, cpu),