[RFC PATCH 2/2] sched/fair: Remove sched_base_slice scaling altogether

From: Tor Vic

Date: Fri Oct 02 2026 - 08:58:41 EST


After having removed the 'none' and 'linear' scalings, remove the
entire tunable scaling mechanism altogether, and just set a fixed
default sched_base_slice of 2 msec.

This can still be changed through debugfs.

Signed-off-by: Tor Vic <torvic9@xxxxxxxxxxx>
---
kernel/sched/core.c | 1 -
kernel/sched/fair.c | 53 +++-----------------------------------------
kernel/sched/sched.h | 3 ---
3 files changed, 3 insertions(+), 54 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 1fe40de6ebe3..2a8a242e20e5 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8942,7 +8942,6 @@ void __init sched_init_smp(void)
if (set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_TYPE_DOMAIN)) < 0)
BUG();
current->flags &= ~PF_NO_SETAFFINITY;
- sched_init_granularity();

init_sched_rt_class();
init_sched_dl_class();
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 2f9b7d2fe813..3d59af44abdf 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -67,10 +67,10 @@
* Under EEVDF this is the request size used to compute the virtual
* deadline; see update_deadline().
*
- * (default: 0.70 msec * (1 + ilog(ncpus)), units: nanoseconds)
+ * (default: 2 msec)
*/
-unsigned int sysctl_sched_base_slice = 700000ULL;
-static unsigned int normalized_sysctl_sched_base_slice = 700000ULL;
+unsigned int sysctl_sched_base_slice = 2000000ULL;
+static unsigned int normalized_sysctl_sched_base_slice = 2000000ULL;

__read_mostly unsigned int sysctl_sched_migration_cost = 500000UL;

@@ -173,38 +173,6 @@ static inline void update_load_set(struct load_weight *lw, unsigned long w)
lw->inv_weight = 0;
}

-/*
- * Increase the granularity value when there are more CPUs,
- * because with more CPUs the 'effective latency' as visible
- * to users decreases. But the relationship is not linear,
- * so pick a second-best guess by going with the log2 of the
- * number of CPUs.
- *
- * This idea comes from the SD scheduler of Con Kolivas:
- */
-static unsigned int get_update_sysctl_factor(void)
-{
- unsigned int cpus = min_t(unsigned int, num_online_cpus(), 8);
- unsigned int factor = 1 + ilog2(cpus);
-
- return factor;
-}
-
-static void update_sysctl(void)
-{
- unsigned int factor = get_update_sysctl_factor();
-
-#define SET_SYSCTL(name) \
- (sysctl_##name = (factor) * normalized_sysctl_##name)
- SET_SYSCTL(sched_base_slice);
-#undef SET_SYSCTL
-}
-
-void __init sched_init_granularity(void)
-{
- update_sysctl();
-}
-
#ifndef CONFIG_64BIT
#define WMULT_CONST (~0U)
#define WMULT_SHIFT 32
@@ -1242,17 +1210,6 @@ struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
/**************************************************************
* Scheduling class statistics methods:
*/
-int sched_update_scaling(void)
-{
- unsigned int factor = get_update_sysctl_factor();
-
-#define WRT_SYSCTL(name) \
- (normalized_sysctl_##name = sysctl_##name / (factor))
- WRT_SYSCTL(sched_base_slice);
-#undef WRT_SYSCTL
-
- return 0;
-}

static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se);

@@ -15011,15 +14968,11 @@ void sched_balance_trigger(struct rq *rq)

static void rq_online_fair(struct rq *rq)
{
- update_sysctl();
-
update_runtime_enabled(rq);
}

static void rq_offline_fair(struct rq *rq)
{
- update_sysctl();
-
/* Ensure any throttled groups are reachable by pick_next_task */
unthrottle_offline_cfs_rqs(rq);

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 7a36b3210757..a323fdeb7125 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2302,8 +2302,6 @@ extern int group_balance_cpu(struct sched_group *sg);
extern void update_sched_domain_debugfs(void);
extern void dirty_sched_domain_sysctl(int cpu);

-extern int sched_update_scaling(void);
-
static inline const struct cpumask *task_user_cpus(struct task_struct *p)
{
if (!p->user_cpus_ptr)
@@ -2987,7 +2985,6 @@ extern void schedule_idle(void);
asmlinkage void schedule_user(void);

extern void sysrq_sched_debug_show(void);
-extern void sched_init_granularity(void);
extern void update_max_interval(void);

extern void init_sched_dl_class(void);
--
2.55.0