Skip to contentSkip to conversation

sched/fair: Remove tunable scaling

RFC PATCH In review Tor Vic 2 participants 5 messages Oct 2 – Oct 12 Scheduler

lore
Share & tools
lore

Tor Vic

author
#0 lore raw

cover sched/fair: Remove tunable scaling

This series removes the scaling of tunables, which was introduced around Linux 2.6.33.

I split this into two separate patches:

The first removes the "none" and "linear" scaling which are likely not used much and have limited usefulness, as one can always set sched_base_slice through debugfs.
It keeps the logarithmic scaling which is already the default.

The second removes the entire scaling mecanism and sets a fixed sched_base_slice of 2 milliseconds, a value which has been chosen somewhat arbitrarily.

Currently, the base_slice multiplied by the log2 factor can take the values of 0.7 (1 CPU), 1.4 (2-3 CPUs), 2.1 (4-7 CPUs) and 2.8 msecs (8+ CPUs), so it seems that the new value of 2 msecs is a sane default, which I also use on my consumer x86_64 machines.
However I'll leave that open for discussion. Note that the base_slice value has changed quite often over the years, lastly in 2025 [1].

The series applies to 7.3-rc5, and is build- and boot tested on a measly 2C/4T Skylake machine. I marked it as RFC because I don't know whether these changes are actually wanted by the sched people - and because I'm not a developer. It does however remove quite a lot of code.

[1] commit 2ae891b826958b60919ea21c727f77bcd6ffcc2c

Tor Vic (2):
sched/fair: Remove the 'none' and 'linear' scaling of tunables sched/fair: Remove sched_base_slice scaling altogether

 include/linux/sched/sysctl.h |  7 ----
 kernel/sched/core.c          |  1 -
 kernel/sched/debug.c         | 52 ------------------------
 kernel/sched/fair.c          | 79 ++----------------------------------
 kernel/sched/sched.h         |  5 ---
 5 files changed, 3 insertions(+), 141 deletions(-)
Signature · 1 line
2.55.0
author
#1 lore raw

RFC PATCH 1/2 sched/fair: Remove the 'none' and 'linear' scaling of tunables

Get rid of the tunable scalings 'none' and 'linear' as these do not appear to be very useful.

Only keep the 'log' scaling, which is already the default.

---
 include/linux/sched/sysctl.h |  7 -----
 kernel/sched/debug.c         | 52 ------------------------------------
 kernel/sched/fair.c          | 28 +------------------
 kernel/sched/sched.h         |  2 --
 4 files changed, 1 insertion(+), 88 deletions(-)
include/linux/sched/sysctl.h +0 -7
index 5a64582b086b..0b923cc771e0 100644
@@ -12,13 +12,6 @@ extern unsigned long sysctl_hung_task_timeout_secs;
 enum { sysctl_hung_task_timeout_secs = 0 };
 #endif
 
-enum sched_tunable_scaling {
-	SCHED_TUNABLESCALING_NONE,
-	SCHED_TUNABLESCALING_LOG,
-	SCHED_TUNABLESCALING_LINEAR,
-	SCHED_TUNABLESCALING_END,
-};
-
 #define NUMA_BALANCING_DISABLED		0x0
 #define NUMA_BALANCING_NORMAL		0x1
 #define NUMA_BALANCING_MEMORY_TIERING	0x2
kernel/sched/debug.c +0 -52

76 lines not on this page · raw message

kernel/sched/fair.c +1 -27
index 57360f5cdde4..2f9b7d2fe813 100644
@@ -61,19 +61,6 @@
 #include "stats.h"
 #include "autogroup.h"
 
-/*
- * The initial- and re-scaling of tunables is configurable
- *
- * Options are:
- *
- *   SCHED_TUNABLESCALING_NONE - unscaled, always *1
- *   SCHED_TUNABLESCALING_LOG - scaled logarithmically, *1+ilog(ncpus)
- *   SCHED_TUNABLESCALING_LINEAR - scaled linear, *ncpus
- *
- * (default SCHED_TUNABLESCALING_LOG = *(1+ilog(ncpus))
- */
-unsigned int sysctl_sched_tunable_scaling = SCHED_TUNABLESCALING_LOG;
-
 /*
  * Default base time slice (request size r_i) for SCHED_NORMAL/SCHED_BATCH:
  *
@@ -198,20 +185,7 @@ static inline void update_load_set(struct load_weight *lw, unsigned long w)
 static unsigned int get_update_sysctl_factor(void)
 {
 	unsigned int cpus = min_t(unsigned int, num_online_cpus(), 8);
-	unsigned int factor;
-
-	switch (sysctl_sched_tunable_scaling) {
-	case SCHED_TUNABLESCALING_NONE:
-		factor = 1;
-		break;
-	case SCHED_TUNABLESCALING_LINEAR:
-		factor = cpus;
-		break;
-	case SCHED_TUNABLESCALING_LOG:
-	default:
-		factor = 1 + ilog2(cpus);
-		break;
-	}
+	unsigned int factor = 1 + ilog2(cpus);
 
 	return factor;
 }
kernel/sched/sched.h +0 -2
index e656c7059bf8..7a36b3210757 100644
@@ -3153,8 +3153,6 @@ extern unsigned int sysctl_sched_base_slice;
 extern int sysctl_resched_latency_warn_ms;
 extern int sysctl_resched_latency_warn_once;
 
-extern unsigned int sysctl_sched_tunable_scaling;
-
 extern unsigned int sysctl_numa_balancing_scan_delay;
 extern unsigned int sysctl_numa_balancing_scan_period_min;
 extern unsigned int sysctl_numa_balancing_scan_period_max;
Signature · 1 line
2.55.0
author
#2 lore raw

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

In reply to Tor Vic

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.

---
 kernel/sched/core.c  |  1 -
 kernel/sched/fair.c  | 53 +++-----------------------------------------
 kernel/sched/sched.h |  3 ---
 3 files changed, 3 insertions(+), 54 deletions(-)
kernel/sched/core.c +0 -1
index 1fe40de6ebe3..2a8a242e20e5 100644
@@ -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();
kernel/sched/fair.c +3 -50

83 lines not on this page · raw message

kernel/sched/sched.h +0 -3
index 7a36b3210757..a323fdeb7125 100644
@@ -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);
Signature · 1 line
2.55.0
maintainer
#3 lore raw
In reply to Tor Vic
Quoted 9 lines · Tor Vic

This series removes the scaling of tunables, which was introduced around Linux 2.6.33.

I split this into two separate patches:

The first removes the "none" and "linear" scaling which are likely not used much and have limited usefulness, as one can always set sched_base_slice through debugfs.

How did you reach this conclusion? and why it's worth removing it

Quoted 4 lines

It keeps the logarithmic scaling which is already the default.

The second removes the entire scaling mecanism and sets a fixed sched_base_slice of 2 milliseconds, a value which has been chosen somewhat arbitrarily.

No, the sysctl_sched_base_slice value has not been chosen arbitrarily and the commit you mentioned below gives you the reason

Quoted 29 lines

Currently, the base_slice multiplied by the log2 factor can take the values of 0.7 (1 CPU), 1.4 (2-3 CPUs), 2.1 (4-7 CPUs) and 2.8 msecs (8+ CPUs), so it seems that the new value of 2 msecs is a sane default, which I also use on my consumer x86_64 machines.
However I'll leave that open for discussion. Note that the base_slice value has changed quite often over the years, lastly in 2025 [1].

The series applies to 7.3-rc5, and is build- and boot tested on a measly 2C/4T Skylake machine. I marked it as RFC because I don't know whether these changes are actually wanted by the sched people - and because I'm not a developer. It does however remove quite a lot of code.

[1] commit 2ae891b826958b60919ea21c727f77bcd6ffcc2c

Tor Vic (2):
sched/fair: Remove the 'none' and 'linear' scaling of tunables sched/fair: Remove sched_base_slice scaling altogether

 include/linux/sched/sysctl.h |  7 ----
 kernel/sched/core.c          |  1 -
 kernel/sched/debug.c         | 52 ------------------------
 kernel/sched/fair.c          | 79 ++----------------------------------
 kernel/sched/sched.h         |  5 ---
 5 files changed, 3 insertions(+), 141 deletions(-)

--
2.55.0

#4 lore raw
Quoted 9 lines

Vincent Guittot <[email protected]> hat am 12.10.2026 14:37 MESZ geschrieben:

Quoted 4 lines · Tor Vic

This series removes the scaling of tunables, which was introduced around Linux 2.6.33.

Quoted 8 lines
Quoted 5 lines

I split this into two separate patches:

The first removes the "none" and "linear" scaling which are likely not used much and have limited usefulness, as one can always set sched_base_slice through debugfs.

How did you reach this conclusion? and why it's worth removing it

I thought that companies would choose a specific base_slice through sysctl, based upon their needs, but then, I'm not active in the IT segment so I might be wrong.

It's possible that there are distributions that use "none" or "linear" by default, but I'm not aware of any.

Quoted 7 lines
Quoted 4 lines

It keeps the logarithmic scaling which is already the default.

The second removes the entire scaling mecanism and sets a fixed sched_base_slice of 2 milliseconds, a value which has been chosen somewhat arbitrarily.

No, the sysctl_sched_base_slice value has not been chosen arbitrarily and the commit you mentioned below gives you the reason

That's a misunderstanding.

I wanted to say that *I* chose the arbitrary 2 ms in this patchset, not that the kernel's default of 0.7 ms was chosen arbitrarily.

Quoted 30 lines
Quoted 30 lines

Currently, the base_slice multiplied by the log2 factor can take the values of 0.7 (1 CPU), 1.4 (2-3 CPUs), 2.1 (4-7 CPUs) and 2.8 msecs (8+ CPUs), so it seems that the new value of 2 msecs is a sane default, which I also use on my consumer x86_64 machines.
However I'll leave that open for discussion. Note that the base_slice value has changed quite often over the years, lastly in 2025 [1].

The series applies to 7.3-rc5, and is build- and boot tested on a measly 2C/4T Skylake machine. I marked it as RFC because I don't know whether these changes are actually wanted by the sched people - and because I'm not a developer. It does however remove quite a lot of code.

[1] commit 2ae891b826958b60919ea21c727f77bcd6ffcc2c

Tor Vic (2):
sched/fair: Remove the 'none' and 'linear' scaling of tunables sched/fair: Remove sched_base_slice scaling altogether

 include/linux/sched/sysctl.h |  7 ----
 kernel/sched/core.c          |  1 -
 kernel/sched/debug.c         | 52 ------------------------
 kernel/sched/fair.c          | 79 ++----------------------------------
 kernel/sched/sched.h         |  5 ---
 5 files changed, 3 insertions(+), 141 deletions(-)

--
2.55.0