diff options
author | Quentin Perret <qperret@google.com> | 2020-06-05 09:06:50 +0100 |
---|---|---|
committer | Quentin Perret <qperret@google.com> | 2020-06-05 16:35:46 +0000 |
commit | bdfa61448f3184fb8a48f25da621532fcbef3d3a (patch) | |
tree | 48cdc9275d5375b39a111d4faf804336dbd8b906 | |
parent | 0d70da26afb1875ad5374b89a3ed19b7e036f4cb (diff) |
ANDROID: sched: Allow EAS without schedutilASB-2020-06-05_mainline
This effectively reverts 531b5c9f5cd0 ("sched/topology: Make Energy
Aware Scheduling depend on schedutil"), and updates the documentation
accordingly.
In the context of GKI 2.0, some partners need to use a custom cpufreq
govenor, but would like to keep EAS enabled.
Remove the hard dependency between them.
Bug: 157580690
Signed-off-by: Quentin Perret <qperret@google.com>
Change-Id: Ied1c5aba6b692e26776b3e2c050780a67cc5bae1
-rw-r--r-- | Documentation/scheduler/sched-energy.rst | 2 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 1 | ||||
-rw-r--r-- | include/linux/cpufreq.h | 8 | ||||
-rw-r--r-- | kernel/sched/cpufreq_schedutil.c | 33 | ||||
-rw-r--r-- | kernel/sched/topology.c | 17 |
5 files changed, 1 insertions, 60 deletions
diff --git a/Documentation/scheduler/sched-energy.rst b/Documentation/scheduler/sched-energy.rst index 9580c57a52bc..97c8376c95f6 100644 --- a/Documentation/scheduler/sched-energy.rst +++ b/Documentation/scheduler/sched-energy.rst @@ -405,7 +405,7 @@ Consequently, the only sane governor to use together with EAS is schedutil, because it is the only one providing some degree of consistency between frequency requests and energy predictions. -Using EAS with any other governor than schedutil is not supported. +Using EAS with any other governor than schedutil is not recommended. 6.5 Scale-invariant utilization signals diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index e427ae930042..30078da47027 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2472,7 +2472,6 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, ret = cpufreq_start_governor(policy); if (!ret) { pr_debug("governor change\n"); - sched_cpufreq_governor_change(policy, old_gov); return 0; } cpufreq_exit_governor(policy); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index f7240251a949..3ff36a4f1fe4 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -979,14 +979,6 @@ static inline bool policy_has_boost_freq(struct cpufreq_policy *policy) } #endif -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) -void sched_cpufreq_governor_change(struct cpufreq_policy *policy, - struct cpufreq_governor *old_gov); -#else -static inline void sched_cpufreq_governor_change(struct cpufreq_policy *policy, - struct cpufreq_governor *old_gov) { } -#endif - extern void arch_freq_prepare_all(void); extern unsigned int arch_freq_get_on_cpu(int cpu); diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 7fbaee24c824..d1cf8c27723a 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -914,36 +914,3 @@ static int __init sugov_register(void) return cpufreq_register_governor(&schedutil_gov); } core_initcall(sugov_register); - -#ifdef CONFIG_ENERGY_MODEL -extern bool sched_energy_update; -extern struct mutex sched_energy_mutex; - -static void rebuild_sd_workfn(struct work_struct *work) -{ - mutex_lock(&sched_energy_mutex); - sched_energy_update = true; - rebuild_sched_domains(); - sched_energy_update = false; - mutex_unlock(&sched_energy_mutex); -} -static DECLARE_WORK(rebuild_sd_work, rebuild_sd_workfn); - -/* - * EAS shouldn't be attempted without sugov, so rebuild the sched_domains - * on governor changes to make sure the scheduler knows about it. - */ -void sched_cpufreq_governor_change(struct cpufreq_policy *policy, - struct cpufreq_governor *old_gov) -{ - if (old_gov == &schedutil_gov || policy->governor == &schedutil_gov) { - /* - * When called from the cpufreq_register_driver() path, the - * cpu_hotplug_lock is already held, so use a work item to - * avoid nested locking in rebuild_sched_domains(). - */ - schedule_work(&rebuild_sd_work); - } - -} -#endif diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 8344757bba6e..843286526ac1 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -319,7 +319,6 @@ static void sched_energy_set(bool has_eas) * 2. the SD_ASYM_CPUCAPACITY flag is set in the sched_domain hierarchy. * 3. no SMT is detected. * 4. the EM complexity is low enough to keep scheduling overheads low; - * 5. schedutil is driving the frequency of all CPUs of the rd; * * The complexity of the Energy Model is defined as: * @@ -339,15 +338,12 @@ static void sched_energy_set(bool has_eas) */ #define EM_MAX_COMPLEXITY 2048 -extern struct cpufreq_governor schedutil_gov; static bool build_perf_domains(const struct cpumask *cpu_map) { int i, nr_pd = 0, nr_cs = 0, nr_cpus = cpumask_weight(cpu_map); struct perf_domain *pd = NULL, *tmp; int cpu = cpumask_first(cpu_map); struct root_domain *rd = cpu_rq(cpu)->rd; - struct cpufreq_policy *policy; - struct cpufreq_governor *gov; if (!sysctl_sched_energy_aware) goto free; @@ -373,19 +369,6 @@ static bool build_perf_domains(const struct cpumask *cpu_map) if (find_pd(pd, i)) continue; - /* Do not attempt EAS if schedutil is not being used. */ - policy = cpufreq_cpu_get(i); - if (!policy) - goto free; - gov = policy->governor; - cpufreq_cpu_put(policy); - if (gov != &schedutil_gov) { - if (rd->pd) - pr_warn("rd %*pbl: Disabling EAS, schedutil is mandatory\n", - cpumask_pr_args(cpu_map)); - goto free; - } - /* Create the new pd and add it to the local list. */ tmp = pd_init(i); if (!tmp) |