linux/drivers/cpufreq
Viresh Kumar 9d53afdb56 RFC: FROMLIST: cpufreq: Add android's 'interactive' governor
https://lkml.org/lkml/2016/9/14/208

Interactive governor has lived in Android sources for a very long time
and this commit is based on the code present in following branch:

https://android.googlesource.com/kernel/common android-4.4

The Interactive governor is designed for latency-sensitive workloads,
such as interactive user interfaces like the mobile phones and tablets.
The interactive governor aims to be significantly more responsive to
ramp CPU quickly up when CPU-intensive activity begins.

Existing governors sample CPU load at a particular rate, typically every
X ms and then update the frequency from a work-handler.  This can lead
to under-powering UI threads for the period of time during which the
user begins interacting with a previously-idle system until the next
sample period happens.

The 'interactive' governor uses a different approach.

A real-time thread is used for scaling up, giving the remaining tasks
the CPU performance benefit, unlike existing governors which are more
likely to schedule ramp-up work to occur after your performance starved
tasks have completed.

The Android version of interactive governor also checks whether to scale
the CPU frequency up soon after coming out of idle.  When the CPU comes
out of idle, the governor check if the CPU sampling is overdue or not.
If yes, it immediately starts the sampling.  Otherwise, the utilization
hooks from the scheduler handle the sampling later.  If the CPU is very
busy from exiting idle to when the evaluation happens, then it assumes
that the CPU is under-powered and ramps it to MAX speed.

If the CPU was not sufficiently busy to immediately ramp to MAX speed,
then the governor evaluates the CPU load since the last speed
adjustment, choosing the highest value between that longer-term load or
the short-term load since idle exit to determine the CPU speed to ramp
to.

The core of this code is written and maintained (in Android
repositories) by Mike Chan and Todd Poyner over a long period of time.

Vireshk has made changes to to the governor to align it with the current
practices followed with mainline governors, like using utilization hooks
from the scheduler and handling kobject (for governor's sysfs directory)
in a race free manner. And of course this included general cleanup of
the governor as well.

Signed-off-by: Mike Chan <mike@android.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Change-Id: Ib5e8d1dab0fa3cc5ba79b7a554c8dde35435cbdb
[AmitP: Cherry-picked this version from
        https://git.kernel.org/cgit/linux/kernel/git/vireshk/pm.git/log/?h=cpufreq/interactive-idle-notifier.
        Also refactored and folded https://lkml.org/lkml/2016/9/14/209
        patch into this unified patch.]
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Liang Chen <cl@rock-chips.com>
(cherry picked from https://android.googlesource.com/kernel/msm
 commit 33f7a05d4e82c81841af20e6a944a4c3f9b2973e)
2022-07-27 15:02:09 +08:00
..
acpi-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
amd_freq_sensitivity.c cpufreq: amd_freq_sensitivity: Mark sometimes used ID structs as __maybe_unused 2020-07-15 15:17:06 +02:00
armada-8k-cpufreq.c cpufreq: ap806: Add missing MODULE_DEVICE_TABLE 2020-12-30 11:53:37 +01:00
armada-37xx-cpufreq.c cpufreq: armada-37xx: forbid cpufreq for 1.2 GHz variant 2021-08-26 08:35:41 -04:00
bmips-cpufreq.c
brcmstb-avs-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
cppc_cpufreq.c cpufreq: CPPC: Reuse caps variable in few routines 2020-07-30 10:57:47 +05:30
cpufreq_conservative.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
cpufreq_governor_attr_set.c cpufreq: schedutil: Destroy mutex before kobject_put() frees the memory 2021-10-06 15:55:46 +02:00
cpufreq_governor.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
cpufreq_governor.h cpufreq: Introduce governor flags 2020-11-10 18:31:17 +01:00
cpufreq_interactive.c RFC: FROMLIST: cpufreq: Add android's 'interactive' governor 2022-07-27 15:02:09 +08:00
cpufreq_ondemand.c cpufreq: Register governors at core_initcall 2020-07-02 13:03:30 +02:00
cpufreq_ondemand.h
cpufreq_performance.c cpufreq: Introduce CPUFREQ_GOV_STRICT_TARGET 2020-11-10 18:31:17 +01:00
cpufreq_powersave.c cpufreq: Introduce CPUFREQ_GOV_STRICT_TARGET 2020-11-10 18:31:17 +01:00
cpufreq_stats.c cpufreq: stats: Fix string format specifier mismatch 2020-10-12 12:32:10 +02:00
cpufreq_times.c ANDROID: vendor_hooks: Add hooks for cpufreq_acct_update_power 2021-06-01 20:59:53 +08:00
cpufreq_userspace.c cpufreq: governor: userspace: Fix frequency error when resume 2021-07-20 18:10:44 +08:00
cpufreq-dt-platdev.c cpufreq: dt-platdev: Add rk3308 project into blacklist 2022-05-18 18:31:15 +08:00
cpufreq-dt.c cpufreq: rockchip: Implement rockchip_cpufreq_opp_set_rate() 2021-11-13 14:52:29 +08:00
cpufreq-dt.h
cpufreq-nforce2.c
cpufreq.c This is the 5.10.94 stable release 2022-01-27 11:49:22 +01:00
davinci-cpufreq.c cpufreq: Replace HTTP links with HTTPS ones 2020-07-13 17:54:37 +02:00
dummy-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
e_powersaver.c cpufreq: e_powersaver: remove unreachable break 2020-10-27 18:42:54 +01:00
elanfreq.c
freq_table.c Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
gx-suspmod.c
highbank-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
ia64-acpi-cpufreq.c
imx-cpufreq-dt.c
imx6q-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
intel_pstate.c cpufreq: intel_pstate: Override parameters if HWP forced by BIOS 2021-09-30 10:11:06 +02:00
Kconfig RFC: FROMLIST: cpufreq: Add android's 'interactive' governor 2022-07-27 15:02:09 +08:00
Kconfig.arm cpufreq: Add runtime initialised driver for rockchip platforms 2021-07-05 11:03:52 +08:00
Kconfig.powerpc
Kconfig.x86
kirkwood-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
longhaul.c cpufreq: e_powersaver: remove unreachable break 2020-10-27 18:42:54 +01:00
longhaul.h
longrun.c
loongson1-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
loongson2_cpufreq.c
Makefile RFC: FROMLIST: cpufreq: Add android's 'interactive' governor 2022-07-27 15:02:09 +08:00
maple-cpufreq.c
mediatek-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
mvebu-cpufreq.c
omap-cpufreq.c OPP: refactor dev_pm_opp_of_register_em() and update related drivers 2020-06-24 17:16:42 +02:00
p4-clockmod.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
pasemi-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
pcc-cpufreq.c cpufreq: pcc-cpufreq: Mark sometimes used ID structs as __maybe_unused 2020-07-15 15:17:06 +02:00
pmac32-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
pmac64-cpufreq.c
powernow-k6.c
powernow-k7.c
powernow-k7.h
powernow-k8.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
powernow-k8.h
powernv-cpufreq.c cpufreq: powernv: Fix init_chip_info initialization in numa=off 2021-09-18 13:40:36 +02:00
ppc_cbe_cpufreq_pervasive.c
ppc_cbe_cpufreq_pmi.c
ppc_cbe_cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
ppc_cbe_cpufreq.h
pxa2xx-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
pxa3xx-cpufreq.c
qcom-cpufreq-hw.c cpufreq: qcom-hw: Fix return value check in qcom_cpufreq_hw_cpu_init() 2021-03-17 17:06:33 +01:00
qcom-cpufreq-nvmem.c cpufreq: qcom-cpufreq-nvmem: fix reading of PVS Valid fuse 2022-04-08 14:40:24 +02:00
qoriq-cpufreq.c
raspberrypi-cpufreq.c
rockchip-cpufreq.c cpufreq: rockchip: Implement rk3588_get_soc_info() 2022-07-22 15:21:04 +08:00
rockchip-cpufreq.h cpufreq: rockchip: Fix compile error when disable rockchip cpufreq 2022-03-10 10:43:11 +08:00
s3c24xx-cpufreq-debugfs.c ARM: s3c: remove cpufreq header dependencies 2020-08-20 17:52:05 +02:00
s3c24xx-cpufreq.c cpufreq: s3c24xx: move low-level clk reg access into platform code 2020-08-20 17:53:22 +02:00
s3c64xx-cpufreq.c
s3c2410-cpufreq.c cpufreq: s3c24xx: move low-level clk reg access into platform code 2020-08-20 17:53:22 +02:00
s3c2412-cpufreq.c cpufreq: s3c24xx: move low-level clk reg access into platform code 2020-08-20 17:53:22 +02:00
s3c2416-cpufreq.c
s3c2440-cpufreq.c cpufreq: s3c24xx: move low-level clk reg access into platform code 2020-08-20 17:53:22 +02:00
s5pv210-cpufreq.c cpufreq: s5pv210: Use dev_err instead of pr_err in probe 2020-09-16 14:12:18 +05:30
sa1100-cpufreq.c
sa1110-cpufreq.c
sc520_freq.c
scmi-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
scpi-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
sfi-cpufreq.c
sh-cpufreq.c
sparc-us2e-cpufreq.c
sparc-us3-cpufreq.c
spear-cpufreq.c
speedstep-centrino.c
speedstep-ich.c
speedstep-lib.c cpufreq: speedstep: remove unneeded semicolon 2020-10-28 18:04:07 +01:00
speedstep-lib.h
speedstep-smi.c
sti-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
sun50i-cpufreq-nvmem.c cpufreq: sun50i: Add missing MODULE_DEVICE_TABLE 2020-12-30 11:53:38 +01:00
tango-cpufreq.c
tegra20-cpufreq.c
tegra124-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
tegra186-cpufreq.c cpufreq: tegra186: Fix get frequency callback 2020-11-17 10:04:21 +05:30
tegra194-cpufreq.c cpufreq: replace cpu_logical_map() with read_cpuid_mpir() 2020-08-21 20:17:01 +02:00
ti-cpufreq.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
vexpress-spc-cpufreq.c cpufreq: vexpress-spc: Add missing MODULE_ALIAS 2020-12-30 11:53:38 +01:00