mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 00/10] Better manage system response time
@ 2026-11-26  5:14 Qais Yousef
  2026-11-26  5:14 ` [PATCH v3 01/10] sched: cpufreq: Rename map_util_perf to sugov_apply_dvfs_headroom Qais Yousef
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Qais Yousef @ 2026-11-26  5:14 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Vincent Guittot, Rafael J. Wysocki,
	Viresh Kumar
  Cc: Juri Lelli, Steven Rostedt, John Stultz, Dietmar Eggemann,
	Tim Chen, Chen, Yu C, Thomas Gleixner, linux-kernel, Qais Yousef

v1 discussion: https://lore.kernel.org/lkml/20240820163512.1096301-1-qyousef@layalina.io/
v2 discussion: https://lore.kernel.org/all/20260504020003.71306-1-qyousef@layalina.io/

I hope this is now in good shape for considering for inclusion.

v1 cover letter has the full details for those interested with the full
background, link available above. LPC discussion from 2024 is available
in [1].

Major changes in this series is dropping the sched_qos interface as this
will be taken on its own discussion now. I also moved away from sysctl
to debugfs interface for setting default rampup_multiplier. Along with
new debugfs entries for fits_capacity_threshold for each CPU to help
understand how these values end up being on different systems if we need
to debug them.

Code changes required reworking how we do the util_est_update_running()
and introduce new running arg to util_est_update(). But other than that
it is exactly the same.

I should have addressed all review comments from last round too,
particularly from Vincent to use us for approximate_runtime() and ensure
that fits_capacity_threshold is updated once; which I attached to
build_sched_domains().

Users can retain the old behavior with these commands (except for
fits_capacity_threshold which I think the new behavior is correct)

	echo 0 | sudo tee /sys/kernel/debug/sched/rampup_multiplier
	echo CONST_DVFS_HEADROOM | sudo tee /sys/kernel/debug/sched/features
	echo NO_UTIL_EST_RAMPUP_ZERO | sudo tee /sys/kernel/debug/sched/features
	echo UTIL_EST_FORCE_POST_INIT | sudo tee /sys/kernel/debug/sched/features

A branch of the changes along side with the sched_qos interface is
available here:

	git clone https://github.com/qais-yousef/linux -b schedqos

schedqos utility [2] has support for this interface on ToT and will
allow per-task control of rampup multiplier to get different response
time for different tasks which is key to get best results in terms of
perf and power. Look at configs/qos_mappings.json - sudo make install
and sudo schedqos restart --daemon.

Testing on 8 CPU SMT2 Ryzen 7 Speedometer 3.1 on Chrome I get the
following results (5 iterations)

tip amd pstate:

	23.3 23.7 23.5 23.9 24.0
	avg: 23.68

tip schedutil:

	20.7 20.5 20.8 20.9 20.3
	avg: 20.64

tip + patch amd pstate:

	23.1 23.9 24.0 23.9 23.8
	avg: 23.74

tip + patch schedutil:

rampup 0:
	13.2 13.2 13.4 13.4 13.2
	avg: 13.28

rampup 1:
	17.5 17.6 17.6 17.7 17.7
	avg: 17.62

rampup 2:
	20.7 20.7 20.6 20.9 20.8
	avg: 20.74

rampup 3:
	21.7 22.0 21.7 21.8 21.5
	avg: 21.74

rampup 4:
	22.5 22.3 22.7 22.4 22.3
	avg: 22.44

rampup 5:
	22.8 22.9 22.8 22.6 22.9
	avg: 22.8

rampup 6:
	23.1 23.1 23.2 23.1 23.2
	avg: 23.14

rampup 7:
	23.4 23.5 23.6 23.4 23.3
	avg: 23.44

rampup 8:
	23.5 23.6 23.5 24.3 24.3
	avg: 23.84

disable cmds (retain old behavior):

	20.7 20.5 20.3 20.5
	avg: 20.5

Notes:
	- rampup 0 and 1 are slower since we no longer have the
	  aggressive const 1.25% dvfs headroom although util signal
	  rises faster for 1. For 0 util_est is completely disabled.
	- rampup 2 we get parity with schedutil.
	- Rampup 8 gives parity with amd pstate behavior, too aggressive
	  for perf. We cross 23 barrier on rampup 6.
	- For rampup 8, battery got low and last 2 iterations ran with
	  power plugged into laptop and this lead to higher score.. Some
	  fimware magic I wasn't aware of and since it was a tedious
	  task I didn't re-run with power plugged.
	- Only 4 iterations for disable cmds

I picked the default rampup_multiplier to be 4 based on this results.
There's power trade-off to be had with different values which I can't
evaluate. Having a per task sched_qos interface to set these values
- which is the intention and final goal - makes this trade-off a lot
easier to be made since as you can see rampup 1 and 0 will get slower
behavior.

This result is based on few weeks old tip/sched/core. Current
tip/sched/core has runnable_avg bug that causes schedutil to run at max
all the time. I managed to workaround it and numbers look different
(higher) but I think the result above are more or less correct in terms
of rampup multiplier value to get parity. Once this bug is fixed I'll
recollect the data.

[1] https://lpc.events/event/18/contributions/1880/
[2] https://github.com/qais-yousef/schedqos

Qais Yousef (10):
  sched: cpufreq: Rename map_util_perf to sugov_apply_dvfs_headroom
  sched/pelt: Add a new function to approximate the future util_avg
    value
  sched/pelt: Add a new function to approximate runtime to reach given
    util
  sched/fair: Remove magic hardcoded margin in fits_capacity()
  sched: cpufreq: Remove magic 1.25 headroom from
    sugov_apply_dvfs_headroom()
  sched/fair: Extend util_est to improve rampup time
  sched/fair: util_est: Take into account periodic tasks
  sched/debugfs: Add rampup_multiplier to debugfs
  sched/fair: Disable util_est when rampup_multiplier is 0
  sched/fair: Don't mess with util_avg post init

 include/linux/sched.h            |   3 +
 include/linux/sched/cpufreq.h    |   5 --
 kernel/sched/core.c              |   5 ++
 kernel/sched/cpufreq_schedutil.c |  41 +++++++++++-
 kernel/sched/debug.c             |  12 +++-
 kernel/sched/fair.c              | 107 ++++++++++++++++++++++++++++---
 kernel/sched/features.h          |  21 ++++++
 kernel/sched/pelt.c              |  44 +++++++++++++
 kernel/sched/sched.h             |  38 +++++++++++
 kernel/sched/topology.c          |   1 +
 10 files changed, 259 insertions(+), 18 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-11-26 10:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-26  5:14 [PATCH v3 00/10] Better manage system response time Qais Yousef
2026-11-26  5:14 ` [PATCH v3 01/10] sched: cpufreq: Rename map_util_perf to sugov_apply_dvfs_headroom Qais Yousef
2026-11-26  5:14 ` [PATCH v3 02/10] sched/pelt: Add a new function to approximate the future util_avg value Qais Yousef
2026-11-26  5:14 ` [PATCH v3 03/10] sched/pelt: Add a new function to approximate runtime to reach given util Qais Yousef
2026-11-26 10:50   ` Li kunyu
2026-11-26  5:14 ` [PATCH v3 04/10] sched/fair: Remove magic hardcoded margin in fits_capacity() Qais Yousef
2026-11-26  5:14 ` [PATCH v3 05/10] sched: cpufreq: Remove magic 1.25 headroom from sugov_apply_dvfs_headroom() Qais Yousef
2026-11-26  5:14 ` [PATCH v3 06/10] sched/fair: Extend util_est to improve rampup time Qais Yousef
2026-11-26  5:14 ` [PATCH v3 07/10] sched/fair: util_est: Take into account periodic tasks Qais Yousef
2026-11-26  5:14 ` [PATCH v3 08/10] sched/debugfs: Add rampup_multiplier to debugfs Qais Yousef
2026-11-26  5:14 ` [PATCH v3 09/10] sched/fair: Disable util_est when rampup_multiplier is 0 Qais Yousef
2026-11-26  5:14 ` [PATCH v3 10/10] sched/fair: Don't mess with util_avg post init Qais Yousef

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®