[PATCH v3 08/10] sched/debugfs: Add rampup_multiplier to debugfs
From: Qais Yousef
Date: Thu Nov 26 2026 - 00:15:03 EST
Bursty tasks are hard to predict. To use resources efficiently, the
system would like to be exact as much as possible. But this poses
a challenge for these bursty tasks that need to get access to more
resources quickly.
The new sysctl_sched_qos_default_rampup_multiplier allows userspace to
do that. As the name implies, it only helps them to transition to
a higher performance state when they get _busier_. That is perfectly
periodic tasks by definition are not going through a transition and will
run at a constant performance level. It is the tasks that need to
transition from one periodic state to another periodic state that is at
a higher level that this rampup_multiplier will help with. It also slows
down the ewma decay of util_est which should help those bursty tasks to
keep their faster rampup.
This should work complimentary with uclamp. uclamp tells the system
about min and max perf requirements which can be applied immediately.
rampup_multiplier is about reactiveness to change in behavior;
specifically when a task gets a sudden burst of work and gets busier.
In practice this is found to be a much better control than uclamp_min as
it is relative parameter and doesn't require absolute description. It
allows the task to go through the motion faster without knowing exactly
how busy it can get at any particular point of time.
The intention is for this rampup multiplier to be applied only during
a burst. It has no effect on perfectly periodic tasks.
This is purely to set the default behavior. The intention is to provide
per task interface later on.
Signed-off-by: Qais Yousef <qyousef@xxxxxxxxxxx>
---
kernel/sched/debug.c | 2 ++
kernel/sched/fair.c | 7 ++++++-
kernel/sched/sched.h | 1 +
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 94e65208807dd..56d520f076dd4 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -756,6 +756,8 @@ static __init int sched_init_debug(void)
debugfs_create_u32("migration_cost_ns", 0644, debugfs_sched, &sysctl_sched_migration_cost);
debugfs_create_u32("nr_migrate", 0644, debugfs_sched, &sysctl_sched_nr_migrate);
+ debugfs_create_u32("rampup_multiplier", 0644, debugfs_sched, &sysctl_sched_qos_default_rampup_multiplier);
+
sched_domains_mutex_lock();
update_sched_domain_debugfs();
sched_domains_mutex_unlock();
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 7129347746436..8af44a20fb423 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -87,6 +87,8 @@ static unsigned int normalized_sysctl_sched_base_slice = 700000ULL;
__read_mostly unsigned int sysctl_sched_migration_cost = 500000UL;
+__read_mostly unsigned int sysctl_sched_qos_default_rampup_multiplier = 4;
+
static int __init setup_sched_thermal_decay_shift(char *str)
{
pr_warn("Ignoring the deprecated sched_thermal_decay_shift= option\n");
@@ -5985,6 +5987,7 @@ static inline unsigned long task_util_dequeued(struct task_struct *p);
static inline void util_est_update(struct sched_entity *se, bool running)
{
+ unsigned long rampup_multiplier = READ_ONCE(sysctl_sched_qos_default_rampup_multiplier);
unsigned int ewma, dequeued, last_ewma_diff;
struct task_struct *p = task_of(se);
@@ -6006,7 +6009,7 @@ static inline void util_est_update(struct sched_entity *se, bool running)
unsigned int prev_ewma = ewma & ~UTIL_AVG_UNCHANGED;
do_div(delta, 1000);
- ewma = approximate_util_avg(prev_ewma, delta);
+ ewma = approximate_util_avg(prev_ewma, delta * rampup_multiplier);
/*
* Keep accumulating delta_exec if it is too small to cause
* a change.
@@ -6074,6 +6077,8 @@ static inline void util_est_update(struct sched_entity *se, bool running)
* 0.25, thus making w=1/4 ( >>= UTIL_EST_WEIGHT_SHIFT)
*/
ewma <<= UTIL_EST_WEIGHT_SHIFT;
+ if (rampup_multiplier)
+ last_ewma_diff /= rampup_multiplier;
ewma -= last_ewma_diff;
ewma >>= UTIL_EST_WEIGHT_SHIFT;
done:
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 27c18701de35c..eea6129c5cba7 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -3270,6 +3270,7 @@ static inline void __attach_tasks(struct rq *rq, struct list_head *tasks)
extern __read_mostly unsigned int sysctl_sched_nr_migrate;
extern __read_mostly unsigned int sysctl_sched_migration_cost;
+extern __read_mostly unsigned int sysctl_sched_qos_default_rampup_multiplier;
extern unsigned int sysctl_sched_base_slice;
--
2.53.0