Energy Aware Scheduling (EAS) is designed with the assumption that frequencies of CPUs follow their utilization value. When using a CPUFreq governor other than schedutil, the chances of this assumption being true are small, if any. When schedutil is being used, EAS' predictions are at least consistent with the frequency requests. Although those requests have no guarantees to be honored by the hardware, they should at least guide DVFS in the right direction and provide some hope in regards to the EAS model being accurate. To make sure EAS is only used in a sane configuration, create a strong dependency on schedutil being used. Since having sugov compiled-in does not provide that guarantee, make CPUFreq call a scheduler function on governor changes hence letting it rebuild the scheduling domains, check the governors of the online CPUs, and enable/disable EAS accordingly. Change-Id: I872949134f97d2772fc681b7393eaed7f0e224f2 Cc: Ingo Molnar <mingo@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Signed-off-by: Quentin Perret <quentin.perret@arm.com> Message-Id: <20181016101513.26919-9-quentin.perret@arm.com> Signed-off-by: Quentin Perret <quentin.perret@arm.com>
40 lines
1.2 KiB
C
40 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_SCHED_CPUFREQ_H
|
|
#define _LINUX_SCHED_CPUFREQ_H
|
|
|
|
#include <linux/cpufreq.h>
|
|
#include <linux/types.h>
|
|
|
|
/*
|
|
* Interface between cpufreq drivers and the scheduler:
|
|
*/
|
|
|
|
#define SCHED_CPUFREQ_IOWAIT (1U << 0)
|
|
#define SCHED_CPUFREQ_MIGRATION (1U << 1)
|
|
|
|
#ifdef CONFIG_CPU_FREQ
|
|
struct update_util_data {
|
|
void (*func)(struct update_util_data *data, u64 time, unsigned int flags);
|
|
};
|
|
|
|
void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data,
|
|
void (*func)(struct update_util_data *data, u64 time,
|
|
unsigned int flags));
|
|
void cpufreq_remove_update_util_hook(int cpu);
|
|
|
|
static inline unsigned long map_util_freq(unsigned long util,
|
|
unsigned long freq, unsigned long cap)
|
|
{
|
|
return (freq + (freq >> 2)) * util / cap;
|
|
}
|
|
#endif /* CONFIG_CPU_FREQ */
|
|
|
|
#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
|
|
|
|
#endif /* _LINUX_SCHED_CPUFREQ_H */
|