linux/drivers/cpufreq
Qais Yousef 37c6dccd68 cpufreq: Remove LATENCY_MULTIPLIER
The current LATENCY_MULTIPLIER which has been around for nearly 20 years
causes rate_limit_us to be always in ms range.

On M1 mac mini I get 50 and 56us transition latency, but due to the 1000
multiplier we end up setting rate_limit_us to 50 and 56ms, which gets
capped into 2ms and was 10ms before e13aa799c2 ("cpufreq: Change
default transition delay to 2ms")

On Intel I5 system transition latency is 20us but due to the multiplier
we end up with 20ms that again is capped to 2ms.

Given how good modern hardware and how modern workloads require systems
to be more responsive to cater for sudden changes in workload (tasks
sleeping/wakeup/migrating, uclamp causing a sudden boost or cap) and
that 2ms is quarter of the time of 120Hz refresh rate system, drop the
old logic in favour of providing 50% headroom.

	rate_limit_us = 1.5 * latency.

I considered not adding any headroom which could mean that we can end up
with infinite back-to-back requests.

I also considered providing a constant headroom (e.g: 100us) assuming
that any h/w or f/w dealing with the request shouldn't require a large
headroom when transition_latency is actually high.

But for both cases I wasn't sure if h/w or f/w can end up being
overwhelmed dealing with the freq requests in a potentially busy system.
So I opted for providing 50% breathing room.

This is expected to impact schedutil only as the other user,
dbs_governor, takes the max(2*tick, transition_delay_us) and the former
was at least 2ms on 1ms TICK, which is equivalent to the max_delay_us
before applying this patch. For systems with TICK of 4ms, this value
would have almost always ended up with 8ms sampling rate.

For systems that report 0 transition latency, we still default to
returning 1ms as transition delay.

This helps in eliminating a source of latency for applying requests as
mentioned in [1]. For example if we have a 1ms tick, most systems will
miss sending an update at tick when updating the util_avg for a task/CPU
(rate_limit_us will be 2ms for most systems).

Link: https://lore.kernel.org/lkml/20240724212255.mfr2ybiv2j2uqek7@airbuntu/ # [1]
Link: https://lore.kernel.org/lkml/20240205022500.2232124-1-qyousef@layalina.io/
Signed-off-by: Qais Yousef <qyousef@layalina.io>
Link: https://patch.msgid.link/20240728192659.58115-1-qyousef@layalina.io
[ rjw: Subject edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2024-08-02 15:56:38 +02:00
..
acpi-cpufreq.c Merge back cpufreq material for 6.11. 2024-07-10 13:03:11 +02:00
amd_freq_sensitivity.c
amd-pstate-trace.c
amd-pstate-trace.h
amd-pstate-ut.c cpufreq/amd-pstate-ut: Convert nominal_freq to khz during comparisons 2024-07-07 10:32:31 -05:00
amd-pstate.c ARM cpufreq updates for 6.11 2024-07-09 17:58:20 +02:00
amd-pstate.h cpufreq: amd-pstate: initialize core precision boost state 2024-06-26 15:48:21 -05:00
apple-soc-cpufreq.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
armada-8k-cpufreq.c cpufreq: armada-8k: Fix parameter type warning 2023-12-18 11:22:57 +05:30
armada-37xx-cpufreq.c cpufreq: Explicitly include correct DT includes 2023-07-20 16:01:57 +05:30
bmips-cpufreq.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
brcmstb-avs-cpufreq.c cpufreq: brcmstb-avs-cpufreq: ISO C90 forbids mixed declarations 2024-04-25 10:36:40 +05:30
cppc_cpufreq.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
cpufreq_conservative.c cpufreq: conservative: Simplify the condition of storing 'down_threshold' 2023-10-06 21:55:13 +02:00
cpufreq_governor_attr_set.c
cpufreq_governor.c cpufreq: governor: Free dbs_data directly when gov->init() fails 2023-08-29 20:21:35 +02:00
cpufreq_governor.h
cpufreq_ondemand.c cpufreq: Remove references to 10ms min sampling rate 2024-02-24 15:02:33 +01:00
cpufreq_ondemand.h
cpufreq_performance.c
cpufreq_powersave.c
cpufreq_stats.c cpufreq: stats: Fix buffer overflow detection in trans_stats() 2023-10-24 22:02:06 +02:00
cpufreq_userspace.c cpufreq: userspace: Move is_managed indicator into per-policy structure 2023-10-06 22:01:26 +02:00
cpufreq-dt-platdev.c cpufreq: dt-platdev: add missing MODULE_DESCRIPTION() macro 2024-06-03 10:13:00 +05:30
cpufreq-dt.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
cpufreq-dt.h
cpufreq-nforce2.c cpufreq: nforce2: Remove empty exit() callback 2024-07-05 11:41:30 +05:30
cpufreq.c cpufreq: Remove LATENCY_MULTIPLIER 2024-08-02 15:56:38 +02:00
davinci-cpufreq.c cpufreq: davinci: Convert to platform remove callback returning void 2023-07-20 16:02:13 +05:30
e_powersaver.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
elanfreq.c
freq_table.c cpufreq: Fix up printing large CPU numbers and frequency values 2024-04-30 12:55:01 +02:00
gx-suspmod.c
highbank-cpufreq.c
imx6q-cpufreq.c cpufreq: imx6: use regmap to read ocotp register 2024-01-23 11:36:21 +05:30
imx-cpufreq-dt.c cpufreq: imx-cpufreq-dt: Convert to platform remove callback returning void 2023-07-20 16:02:13 +05:30
intel_pstate.c cpufreq: intel_pstate: Update Balance performance EPP for Emerald Rapids 2024-08-02 14:40:13 +02:00
Kconfig cpufreq: Add Loongson-3 CPUFreq driver support 2024-07-09 08:45:43 +05:30
Kconfig.arm RISC-V Patches for the 6.9 Merge Window 2024-03-22 10:41:13 -07:00
Kconfig.powerpc
Kconfig.x86 cpufreq: amd-pstate: Make amd-pstate unit tests depend on amd-pstate 2024-06-24 13:17:56 -05:00
kirkwood-cpufreq.c cpufreq: kirkwood: Convert to platform remove callback returning void 2023-07-20 16:02:13 +05:30
longhaul.c cpufreq: longhaul: Fix kernel-doc param for longhaul_setstate 2024-05-28 12:20:13 +05:30
longhaul.h
longrun.c
loongson2_cpufreq.c cpufreq: loongson2: Remove empty exit() callback 2024-07-05 11:41:46 +05:30
loongson3_cpufreq.c cpufreq: Add Loongson-3 CPUFreq driver support 2024-07-09 08:45:43 +05:30
Makefile cpufreq: Add Loongson-3 CPUFreq driver support 2024-07-09 08:45:43 +05:30
maple-cpufreq.c cpufreq: powerpc: add missing MODULE_DESCRIPTION() macros 2024-08-02 14:45:20 +02:00
mediatek-cpufreq-hw.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
mediatek-cpufreq.c cpufreq: mediatek: Use dev_err_probe in every error path in probe 2024-07-09 08:45:43 +05:30
mvebu-cpufreq.c
omap-cpufreq.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
p4-clockmod.c
pasemi-cpufreq.c cpufreq: powerpc: add missing MODULE_DESCRIPTION() macros 2024-08-02 14:45:20 +02:00
pcc-cpufreq.c cpufreq: pcc: Remove empty exit() callback 2024-07-05 11:42:00 +05:30
pmac32-cpufreq.c powerpc: rename SPRN_HID2 define to SPRN_HID2_750FX 2024-05-08 00:25:00 +10:00
pmac64-cpufreq.c cpufreq: powerpc: add missing MODULE_DESCRIPTION() macros 2024-08-02 14:45:20 +02:00
powernow-k6.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
powernow-k7.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
powernow-k7.h
powernow-k8.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
powernow-k8.h
powernv-cpufreq.c cpufreq: powerpc: add missing MODULE_DESCRIPTION() macros 2024-08-02 14:45:20 +02:00
ppc_cbe_cpufreq_pervasive.c
ppc_cbe_cpufreq_pmi.c cpufreq: Explicitly include correct DT includes 2023-07-20 16:01:57 +05:30
ppc_cbe_cpufreq.c cpufreq: powerpc: add missing MODULE_DESCRIPTION() macros 2024-08-02 14:45:20 +02:00
ppc_cbe_cpufreq.h
pxa2xx-cpufreq.c
pxa3xx-cpufreq.c
qcom-cpufreq-hw.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
qcom-cpufreq-nvmem.c Power management updates for 6.11-rc1 2024-07-16 15:54:03 -07:00
qoriq-cpufreq.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
raspberrypi-cpufreq.c cpufreq: raspberrypi: Convert to platform remove callback returning void 2023-07-20 16:02:13 +05:30
s3c64xx-cpufreq.c
s5pv210-cpufreq.c
sa1110-cpufreq.c
sc520_freq.c
scmi-cpufreq.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
scpi-cpufreq.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
sh-cpufreq.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
sparc-us2e-cpufreq.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
sparc-us3-cpufreq.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
spear-cpufreq.c
speedstep-centrino.c ARM cpufreq updates for 6.11 2024-07-09 17:58:20 +02:00
speedstep-ich.c
speedstep-lib.c
speedstep-lib.h
speedstep-smi.c
sti-cpufreq.c cpufreq: sti: fix build warning 2024-07-09 08:45:43 +05:30
sun50i-cpufreq-nvmem.c cpufreq: sun50i: add Allwinner H700 speed bin 2024-06-19 08:45:40 +05:30
tegra20-cpufreq.c
tegra124-cpufreq.c cpupfreq: tegra124: eliminate uses of of_node_put() 2024-04-19 11:55:44 +05:30
tegra186-cpufreq.c cpufreq: tegra186: Convert to platform remove callback returning void 2023-07-20 16:02:13 +05:30
tegra194-cpufreq.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30
ti-cpufreq.c cpufreq: ti: update OPP table for AM62Px SoCs 2024-06-25 12:46:17 +05:30
vexpress-spc-cpufreq.c cpufreq: Make cpufreq_driver->exit() return void 2024-07-09 08:45:30 +05:30