2024-11-08 13:08:02 +01:00
|
|
|
From 318c40e6ac298c062db3e34a9e94e75b81d3a653 Mon Sep 17 00:00:00 2001
|
2024-10-05 18:13:24 +02:00
|
|
|
From: Eric Naim <dnaim@cachyos.org>
|
2024-11-08 13:08:02 +01:00
|
|
|
Date: Mon, 28 Oct 2024 10:11:08 +0800
|
2024-08-30 15:04:41 +02:00
|
|
|
Subject: [PATCH] bore-cachy-ext
|
|
|
|
|
2024-10-05 18:13:24 +02:00
|
|
|
Signed-off-by: Eric Naim <dnaim@cachyos.org>
|
2024-08-30 15:04:41 +02:00
|
|
|
---
|
2024-10-05 18:13:24 +02:00
|
|
|
include/linux/sched.h | 20 +-
|
|
|
|
include/linux/sched/bore.h | 37 ++++
|
2024-10-02 18:22:48 +02:00
|
|
|
init/Kconfig | 17 ++
|
2024-11-08 13:08:02 +01:00
|
|
|
kernel/Kconfig.hz | 43 +++++
|
2024-10-02 18:22:48 +02:00
|
|
|
kernel/fork.c | 5 +
|
|
|
|
kernel/sched/Makefile | 1 +
|
2024-10-10 18:22:46 +02:00
|
|
|
kernel/sched/bore.c | 381 +++++++++++++++++++++++++++++++++++++
|
2024-10-02 18:22:48 +02:00
|
|
|
kernel/sched/core.c | 7 +
|
2024-11-08 13:08:02 +01:00
|
|
|
kernel/sched/debug.c | 67 ++++++-
|
|
|
|
kernel/sched/fair.c | 114 +++++++++--
|
2024-10-02 18:22:48 +02:00
|
|
|
kernel/sched/features.h | 4 +
|
2024-11-08 13:08:02 +01:00
|
|
|
kernel/sched/sched.h | 16 ++
|
|
|
|
12 files changed, 694 insertions(+), 18 deletions(-)
|
2024-10-02 18:22:48 +02:00
|
|
|
create mode 100644 include/linux/sched/bore.h
|
|
|
|
create mode 100644 kernel/sched/bore.c
|
2024-08-30 15:04:41 +02:00
|
|
|
|
|
|
|
diff --git a/include/linux/sched.h b/include/linux/sched.h
|
2024-10-10 18:22:46 +02:00
|
|
|
index c5a7901b2580..bab2d659b667 100644
|
2024-08-30 15:04:41 +02:00
|
|
|
--- a/include/linux/sched.h
|
|
|
|
+++ b/include/linux/sched.h
|
2024-10-05 18:13:24 +02:00
|
|
|
@@ -537,6 +537,14 @@ struct sched_statistics {
|
|
|
|
#endif /* CONFIG_SCHEDSTATS */
|
|
|
|
} ____cacheline_aligned;
|
|
|
|
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+struct sched_burst_cache {
|
|
|
|
+ u8 score;
|
|
|
|
+ u32 count;
|
|
|
|
+ u64 timestamp;
|
|
|
|
+};
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
+
|
|
|
|
struct sched_entity {
|
|
|
|
/* For load-balancing: */
|
|
|
|
struct load_weight load;
|
|
|
|
@@ -545,12 +553,22 @@ struct sched_entity {
|
2024-10-02 18:22:48 +02:00
|
|
|
u64 min_vruntime;
|
|
|
|
|
|
|
|
struct list_head group_node;
|
|
|
|
- unsigned int on_rq;
|
|
|
|
+ unsigned char on_rq;
|
|
|
|
+ unsigned char rel_deadline;
|
|
|
|
|
|
|
|
u64 exec_start;
|
2024-08-30 15:04:41 +02:00
|
|
|
u64 sum_exec_runtime;
|
|
|
|
u64 prev_sum_exec_runtime;
|
|
|
|
u64 vruntime;
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+ u64 burst_time;
|
|
|
|
+ u8 prev_burst_penalty;
|
|
|
|
+ u8 curr_burst_penalty;
|
|
|
|
+ u8 burst_penalty;
|
|
|
|
+ u8 burst_score;
|
2024-10-05 18:13:24 +02:00
|
|
|
+ struct sched_burst_cache child_burst;
|
|
|
|
+ struct sched_burst_cache group_burst;
|
2024-08-30 15:04:41 +02:00
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
s64 vlag;
|
|
|
|
u64 slice;
|
|
|
|
|
2024-10-02 18:22:48 +02:00
|
|
|
diff --git a/include/linux/sched/bore.h b/include/linux/sched/bore.h
|
|
|
|
new file mode 100644
|
2024-10-05 18:13:24 +02:00
|
|
|
index 000000000000..12a613a94ff0
|
2024-10-02 18:22:48 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/include/linux/sched/bore.h
|
2024-10-05 18:13:24 +02:00
|
|
|
@@ -0,0 +1,37 @@
|
2024-10-02 18:22:48 +02:00
|
|
|
+
|
|
|
|
+#include <linux/sched.h>
|
|
|
|
+#include <linux/sched/cputime.h>
|
|
|
|
+
|
|
|
|
+#ifndef _LINUX_SCHED_BORE_H
|
|
|
|
+#define _LINUX_SCHED_BORE_H
|
|
|
|
+
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+extern u8 __read_mostly sched_bore;
|
|
|
|
+extern u8 __read_mostly sched_burst_exclude_kthreads;
|
|
|
|
+extern u8 __read_mostly sched_burst_smoothness_long;
|
|
|
|
+extern u8 __read_mostly sched_burst_smoothness_short;
|
2024-10-05 18:13:24 +02:00
|
|
|
+extern u8 __read_mostly sched_burst_fork_atavistic;
|
2024-10-02 18:22:48 +02:00
|
|
|
+extern u8 __read_mostly sched_burst_parity_threshold;
|
|
|
|
+extern u8 __read_mostly sched_burst_penalty_offset;
|
|
|
|
+extern uint __read_mostly sched_burst_penalty_scale;
|
|
|
|
+extern uint __read_mostly sched_burst_cache_lifetime;
|
|
|
|
+extern uint __read_mostly sched_deadline_boost_mask;
|
|
|
|
+
|
|
|
|
+extern void update_burst_score(struct sched_entity *se);
|
|
|
|
+extern void update_burst_penalty(struct sched_entity *se);
|
|
|
|
+
|
|
|
|
+extern void restart_burst(struct sched_entity *se);
|
|
|
|
+extern void restart_burst_rescale_deadline(struct sched_entity *se);
|
|
|
|
+
|
|
|
|
+extern int sched_bore_update_handler(const struct ctl_table *table, int write,
|
|
|
|
+ void __user *buffer, size_t *lenp, loff_t *ppos);
|
|
|
|
+
|
|
|
|
+extern void sched_clone_bore(
|
|
|
|
+ struct task_struct *p, struct task_struct *parent, u64 clone_flags);
|
|
|
|
+
|
|
|
|
+extern void init_task_bore(struct task_struct *p);
|
|
|
|
+
|
|
|
|
+extern void reweight_entity(
|
|
|
|
+ struct cfs_rq *cfs_rq, struct sched_entity *se, unsigned long weight);
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
+#endif // _LINUX_SCHED_BORE_H
|
2024-08-30 15:04:41 +02:00
|
|
|
diff --git a/init/Kconfig b/init/Kconfig
|
2024-10-05 18:13:24 +02:00
|
|
|
index e1a88d48d652..3aea8e43c360 100644
|
2024-08-30 15:04:41 +02:00
|
|
|
--- a/init/Kconfig
|
|
|
|
+++ b/init/Kconfig
|
2024-09-16 14:10:53 +02:00
|
|
|
@@ -1327,6 +1327,23 @@ config CHECKPOINT_RESTORE
|
2024-08-30 15:04:41 +02:00
|
|
|
|
|
|
|
If unsure, say N here.
|
|
|
|
|
|
|
|
+config SCHED_BORE
|
|
|
|
+ bool "Burst-Oriented Response Enhancer"
|
|
|
|
+ default y
|
|
|
|
+ help
|
|
|
|
+ In Desktop and Mobile computing, one might prefer interactive
|
|
|
|
+ tasks to keep responsive no matter what they run in the background.
|
|
|
|
+
|
|
|
|
+ Enabling this kernel feature modifies the scheduler to discriminate
|
|
|
|
+ tasks by their burst time (runtime since it last went sleeping or
|
|
|
|
+ yielding state) and prioritize those that run less bursty.
|
|
|
|
+ Such tasks usually include window compositor, widgets backend,
|
|
|
|
+ terminal emulator, video playback, games and so on.
|
|
|
|
+ With a little impact to scheduling fairness, it may improve
|
|
|
|
+ responsiveness especially under heavy background workload.
|
|
|
|
+
|
|
|
|
+ If unsure, say Y here.
|
|
|
|
+
|
|
|
|
config SCHED_AUTOGROUP
|
|
|
|
bool "Automatic process group scheduling"
|
|
|
|
select CGROUPS
|
|
|
|
diff --git a/kernel/Kconfig.hz b/kernel/Kconfig.hz
|
2024-11-08 13:08:02 +01:00
|
|
|
index 0f78364efd4f..4cf2d88916bd 100644
|
2024-08-30 15:04:41 +02:00
|
|
|
--- a/kernel/Kconfig.hz
|
|
|
|
+++ b/kernel/Kconfig.hz
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -79,5 +79,48 @@ config HZ
|
2024-08-30 15:04:41 +02:00
|
|
|
default 750 if HZ_750
|
|
|
|
default 1000 if HZ_1000
|
|
|
|
|
|
|
|
+config MIN_BASE_SLICE_NS
|
|
|
|
+ int "Default value for min_base_slice_ns"
|
|
|
|
+ default 2000000
|
|
|
|
+ help
|
|
|
|
+ The BORE Scheduler automatically calculates the optimal base
|
|
|
|
+ slice for the configured HZ using the following equation:
|
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+ base_slice_ns =
|
|
|
|
+ 1000000000/HZ * DIV_ROUNDUP(min_base_slice_ns, 1000000000/HZ)
|
2024-08-30 15:04:41 +02:00
|
|
|
+
|
|
|
|
+ This option sets the default lower bound limit of the base slice
|
|
|
|
+ to prevent the loss of task throughput due to overscheduling.
|
|
|
|
+
|
|
|
|
+ Setting this value too high can cause the system to boot with
|
|
|
|
+ an unnecessarily large base slice, resulting in high scheduling
|
|
|
|
+ latency and poor system responsiveness.
|
2024-11-08 13:08:02 +01:00
|
|
|
+
|
|
|
|
+config MIGRATION_COST_BASE_NS
|
|
|
|
+ int "Default value for migration_cost_base_ns"
|
|
|
|
+ default 300000
|
|
|
|
+ help
|
|
|
|
+ The BORE Scheduler automatically calculates the optimal
|
|
|
|
+ migration_cost_ns using the following equation:
|
|
|
|
+
|
|
|
|
+ migration_cost_ns =
|
|
|
|
+ migration_cost_base_ns + ilog2(ncpus) * migration_cost_step_ns
|
|
|
|
+
|
|
|
|
+ This option sets the default migration_cost_base_ns
|
|
|
|
+ to be used in the automatic calculation.
|
|
|
|
+
|
|
|
|
+config MIGRATION_COST_STEP_NS
|
|
|
|
+ int "Default value for migration_cost_step_ns"
|
|
|
|
+ default 50000
|
|
|
|
+ help
|
|
|
|
+ The BORE Scheduler automatically calculates the optimal
|
|
|
|
+ migration_cost_ns using the following equation:
|
|
|
|
+
|
|
|
|
+ migration_cost_ns =
|
|
|
|
+ migration_cost_base_ns + ilog2(ncpus) * migration_cost_step_ns
|
|
|
|
+
|
|
|
|
+ This option sets the default migration_cost_step_ns
|
|
|
|
+ to be used in the automatic calculation.
|
2024-08-30 15:04:41 +02:00
|
|
|
+
|
|
|
|
config SCHED_HRTICK
|
|
|
|
def_bool HIGH_RES_TIMERS
|
2024-10-02 18:22:48 +02:00
|
|
|
diff --git a/kernel/fork.c b/kernel/fork.c
|
2024-10-10 18:22:46 +02:00
|
|
|
index eb290420d926..8f060c73877b 100644
|
2024-10-02 18:22:48 +02:00
|
|
|
--- a/kernel/fork.c
|
|
|
|
+++ b/kernel/fork.c
|
|
|
|
@@ -116,6 +116,8 @@
|
|
|
|
#include <asm/cacheflush.h>
|
|
|
|
#include <asm/tlbflush.h>
|
2024-08-30 15:04:41 +02:00
|
|
|
|
2024-10-02 18:22:48 +02:00
|
|
|
+#include <linux/sched/bore.h>
|
2024-08-30 15:04:41 +02:00
|
|
|
+
|
2024-10-02 18:22:48 +02:00
|
|
|
#include <trace/events/sched.h>
|
2024-08-30 15:04:41 +02:00
|
|
|
|
2024-10-02 18:22:48 +02:00
|
|
|
#define CREATE_TRACE_POINTS
|
2024-10-10 18:22:46 +02:00
|
|
|
@@ -2351,6 +2353,9 @@ __latent_entropy struct task_struct *copy_process(
|
2024-10-02 18:22:48 +02:00
|
|
|
retval = sched_fork(clone_flags, p);
|
|
|
|
if (retval)
|
|
|
|
goto bad_fork_cleanup_policy;
|
2024-08-30 15:04:41 +02:00
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
2024-10-02 18:22:48 +02:00
|
|
|
+ sched_clone_bore(p, current, clone_flags);
|
2024-08-30 15:04:41 +02:00
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
|
2024-10-02 18:22:48 +02:00
|
|
|
retval = perf_event_init_task(p, clone_flags);
|
|
|
|
if (retval)
|
|
|
|
diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
|
2024-10-05 18:13:24 +02:00
|
|
|
index 976092b7bd45..293aad675444 100644
|
2024-10-02 18:22:48 +02:00
|
|
|
--- a/kernel/sched/Makefile
|
|
|
|
+++ b/kernel/sched/Makefile
|
|
|
|
@@ -32,3 +32,4 @@ obj-y += core.o
|
|
|
|
obj-y += fair.o
|
|
|
|
obj-y += build_policy.o
|
|
|
|
obj-y += build_utility.o
|
|
|
|
+obj-y += bore.o
|
|
|
|
diff --git a/kernel/sched/bore.c b/kernel/sched/bore.c
|
|
|
|
new file mode 100644
|
2024-10-10 18:22:46 +02:00
|
|
|
index 000000000000..cd7e8a8d6075
|
2024-10-02 18:22:48 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/kernel/sched/bore.c
|
2024-10-10 18:22:46 +02:00
|
|
|
@@ -0,0 +1,381 @@
|
2024-10-02 18:22:48 +02:00
|
|
|
+/*
|
2024-08-30 15:04:41 +02:00
|
|
|
+ * Burst-Oriented Response Enhancer (BORE) CPU Scheduler
|
|
|
|
+ * Copyright (C) 2021-2024 Masahito Suzuki <firelzrd@gmail.com>
|
2024-10-02 18:22:48 +02:00
|
|
|
+ */
|
|
|
|
+#include <linux/cpuset.h>
|
|
|
|
+#include <linux/sched/bore.h>
|
|
|
|
+#include "sched.h"
|
2024-08-30 15:04:41 +02:00
|
|
|
+
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+u8 __read_mostly sched_bore = 1;
|
|
|
|
+u8 __read_mostly sched_burst_exclude_kthreads = 1;
|
|
|
|
+u8 __read_mostly sched_burst_smoothness_long = 1;
|
|
|
|
+u8 __read_mostly sched_burst_smoothness_short = 0;
|
2024-10-05 18:13:24 +02:00
|
|
|
+u8 __read_mostly sched_burst_fork_atavistic = 2;
|
2024-09-20 23:18:02 +02:00
|
|
|
+u8 __read_mostly sched_burst_parity_threshold = 2;
|
2024-10-05 18:13:24 +02:00
|
|
|
+u8 __read_mostly sched_burst_penalty_offset = 24;
|
2024-08-30 15:04:41 +02:00
|
|
|
+uint __read_mostly sched_burst_penalty_scale = 1280;
|
|
|
|
+uint __read_mostly sched_burst_cache_lifetime = 60000000;
|
|
|
|
+uint __read_mostly sched_deadline_boost_mask = ENQUEUE_INITIAL
|
|
|
|
+ | ENQUEUE_WAKEUP;
|
|
|
|
+static int __maybe_unused sixty_four = 64;
|
2024-09-20 23:18:02 +02:00
|
|
|
+static int __maybe_unused maxval_u8 = 255;
|
2024-08-30 15:04:41 +02:00
|
|
|
+static int __maybe_unused maxval_12_bits = 4095;
|
|
|
|
+
|
|
|
|
+#define MAX_BURST_PENALTY (39U <<2)
|
|
|
|
+
|
|
|
|
+static inline u32 log2plus1_u64_u32f8(u64 v) {
|
2024-10-05 18:13:24 +02:00
|
|
|
+ u32 integral = fls64(v);
|
|
|
|
+ u8 fractional = v << (64 - integral) >> 55;
|
|
|
|
+ return integral << 8 | fractional;
|
2024-08-30 15:04:41 +02:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static inline u32 calc_burst_penalty(u64 burst_time) {
|
|
|
|
+ u32 greed, tolerance, penalty, scaled_penalty;
|
|
|
|
+
|
|
|
|
+ greed = log2plus1_u64_u32f8(burst_time);
|
|
|
|
+ tolerance = sched_burst_penalty_offset << 8;
|
2024-10-02 18:22:48 +02:00
|
|
|
+ penalty = max(0, (s32)(greed - tolerance));
|
2024-08-30 15:04:41 +02:00
|
|
|
+ scaled_penalty = penalty * sched_burst_penalty_scale >> 16;
|
|
|
|
+
|
|
|
|
+ return min(MAX_BURST_PENALTY, scaled_penalty);
|
|
|
|
+}
|
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+static inline u64 __scale_slice(u64 delta, u8 score)
|
|
|
|
+{return mul_u64_u32_shr(delta, sched_prio_to_wmult[score], 22);}
|
2024-08-30 15:04:41 +02:00
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+static inline u64 __unscale_slice(u64 delta, u8 score)
|
|
|
|
+{return mul_u64_u32_shr(delta, sched_prio_to_weight[score], 10);}
|
2024-08-30 15:04:41 +02:00
|
|
|
+
|
2024-10-02 18:22:48 +02:00
|
|
|
+static void reweight_task_by_prio(struct task_struct *p, int prio) {
|
2024-08-30 15:04:41 +02:00
|
|
|
+ struct sched_entity *se = &p->se;
|
|
|
|
+ unsigned long weight = scale_load(sched_prio_to_weight[prio]);
|
|
|
|
+
|
2024-10-02 18:22:48 +02:00
|
|
|
+ reweight_entity(cfs_rq_of(se), se, weight);
|
|
|
|
+ se->load.inv_weight = sched_prio_to_wmult[prio];
|
2024-08-30 15:04:41 +02:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static inline u8 effective_prio(struct task_struct *p) {
|
|
|
|
+ u8 prio = p->static_prio - MAX_RT_PRIO;
|
|
|
|
+ if (likely(sched_bore))
|
|
|
|
+ prio += p->se.burst_score;
|
|
|
|
+ return min(39, prio);
|
|
|
|
+}
|
|
|
|
+
|
2024-10-02 18:22:48 +02:00
|
|
|
+void update_burst_score(struct sched_entity *se) {
|
2024-08-30 15:04:41 +02:00
|
|
|
+ if (!entity_is_task(se)) return;
|
|
|
|
+ struct task_struct *p = task_of(se);
|
|
|
|
+ u8 prev_prio = effective_prio(p);
|
|
|
|
+
|
|
|
|
+ u8 burst_score = 0;
|
2024-09-16 14:10:53 +02:00
|
|
|
+ if (!((p->flags & PF_KTHREAD) && likely(sched_burst_exclude_kthreads)))
|
2024-08-30 15:04:41 +02:00
|
|
|
+ burst_score = se->burst_penalty >> 2;
|
|
|
|
+ se->burst_score = burst_score;
|
|
|
|
+
|
|
|
|
+ u8 new_prio = effective_prio(p);
|
|
|
|
+ if (new_prio != prev_prio)
|
|
|
|
+ reweight_task_by_prio(p, new_prio);
|
|
|
|
+}
|
|
|
|
+
|
2024-10-02 18:22:48 +02:00
|
|
|
+void update_burst_penalty(struct sched_entity *se) {
|
2024-08-30 15:04:41 +02:00
|
|
|
+ se->curr_burst_penalty = calc_burst_penalty(se->burst_time);
|
|
|
|
+ se->burst_penalty = max(se->prev_burst_penalty, se->curr_burst_penalty);
|
|
|
|
+ update_burst_score(se);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static inline u32 binary_smooth(u32 new, u32 old) {
|
2024-09-16 14:10:53 +02:00
|
|
|
+ int increment = new - old;
|
|
|
|
+ return (0 <= increment)?
|
|
|
|
+ old + ( increment >> (int)sched_burst_smoothness_long):
|
|
|
|
+ old - (-increment >> (int)sched_burst_smoothness_short);
|
2024-08-30 15:04:41 +02:00
|
|
|
+}
|
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+static void revolve_burst_penalty(struct sched_entity *se) {
|
2024-10-02 18:22:48 +02:00
|
|
|
+ se->prev_burst_penalty =
|
2024-08-30 15:04:41 +02:00
|
|
|
+ binary_smooth(se->curr_burst_penalty, se->prev_burst_penalty);
|
|
|
|
+ se->burst_time = 0;
|
2024-10-02 18:22:48 +02:00
|
|
|
+ se->curr_burst_penalty = 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+inline void restart_burst(struct sched_entity *se) {
|
2024-10-05 18:13:24 +02:00
|
|
|
+ revolve_burst_penalty(se);
|
2024-10-02 18:22:48 +02:00
|
|
|
+ se->burst_penalty = se->prev_burst_penalty;
|
2024-08-30 15:04:41 +02:00
|
|
|
+ update_burst_score(se);
|
|
|
|
+}
|
|
|
|
+
|
2024-10-02 18:22:48 +02:00
|
|
|
+void restart_burst_rescale_deadline(struct sched_entity *se) {
|
2024-08-30 15:04:41 +02:00
|
|
|
+ s64 vscaled, wremain, vremain = se->deadline - se->vruntime;
|
|
|
|
+ struct task_struct *p = task_of(se);
|
|
|
|
+ u8 prev_prio = effective_prio(p);
|
|
|
|
+ restart_burst(se);
|
|
|
|
+ u8 new_prio = effective_prio(p);
|
|
|
|
+ if (prev_prio > new_prio) {
|
|
|
|
+ wremain = __unscale_slice(abs(vremain), prev_prio);
|
|
|
|
+ vscaled = __scale_slice(wremain, new_prio);
|
|
|
|
+ if (unlikely(vremain < 0))
|
|
|
|
+ vscaled = -vscaled;
|
|
|
|
+ se->deadline = se->vruntime + vscaled;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
2024-10-10 18:22:46 +02:00
|
|
|
+static inline bool task_is_bore_eligible(struct task_struct *p)
|
|
|
|
+{return p->sched_class == &fair_sched_class;}
|
|
|
|
+
|
2024-08-30 15:04:41 +02:00
|
|
|
+static void reset_task_weights_bore(void) {
|
2024-09-16 14:10:53 +02:00
|
|
|
+ struct task_struct *task;
|
|
|
|
+ struct rq *rq;
|
|
|
|
+ struct rq_flags rf;
|
|
|
|
+
|
|
|
|
+ write_lock_irq(&tasklist_lock);
|
|
|
|
+ for_each_process(task) {
|
2024-10-10 18:22:46 +02:00
|
|
|
+ if (!task_is_bore_eligible(task)) continue;
|
2024-09-16 14:10:53 +02:00
|
|
|
+ rq = task_rq(task);
|
|
|
|
+ rq_lock_irqsave(rq, &rf);
|
|
|
|
+ reweight_task_by_prio(task, effective_prio(task));
|
|
|
|
+ rq_unlock_irqrestore(rq, &rf);
|
|
|
|
+ }
|
|
|
|
+ write_unlock_irq(&tasklist_lock);
|
2024-08-30 15:04:41 +02:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int sched_bore_update_handler(const struct ctl_table *table, int write,
|
2024-10-02 18:22:48 +02:00
|
|
|
+ void __user *buffer, size_t *lenp, loff_t *ppos) {
|
2024-08-30 15:04:41 +02:00
|
|
|
+ int ret = proc_dou8vec_minmax(table, write, buffer, lenp, ppos);
|
|
|
|
+ if (ret || !write)
|
|
|
|
+ return ret;
|
|
|
|
+
|
|
|
|
+ reset_task_weights_bore();
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
2024-10-02 18:22:48 +02:00
|
|
|
+
|
|
|
|
+static u32 count_child_tasks(struct task_struct *p) {
|
|
|
|
+ struct task_struct *child;
|
|
|
|
+ u32 cnt = 0;
|
|
|
|
+ list_for_each_entry(child, &p->children, sibling) {cnt++;}
|
|
|
|
+ return cnt;
|
|
|
|
+}
|
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+static inline bool burst_cache_expired(struct sched_burst_cache *bc, u64 now)
|
|
|
|
+{return (s64)(bc->timestamp + sched_burst_cache_lifetime - now) < 0;}
|
2024-10-02 18:22:48 +02:00
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+static void update_burst_cache(struct sched_burst_cache *bc,
|
2024-10-02 18:22:48 +02:00
|
|
|
+ struct task_struct *p, u32 cnt, u32 sum, u64 now) {
|
|
|
|
+ u8 avg = cnt ? sum / cnt : 0;
|
2024-10-05 18:13:24 +02:00
|
|
|
+ bc->score = max(avg, p->se.burst_penalty);
|
|
|
|
+ bc->count = cnt;
|
|
|
|
+ bc->timestamp = now;
|
2024-10-02 18:22:48 +02:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static inline void update_child_burst_direct(struct task_struct *p, u64 now) {
|
|
|
|
+ u32 cnt = 0, sum = 0;
|
|
|
|
+ struct task_struct *child;
|
|
|
|
+
|
|
|
|
+ list_for_each_entry(child, &p->children, sibling) {
|
2024-10-05 18:13:24 +02:00
|
|
|
+ if (!task_is_bore_eligible(child)) continue;
|
2024-10-02 18:22:48 +02:00
|
|
|
+ cnt++;
|
|
|
|
+ sum += child->se.burst_penalty;
|
|
|
|
+ }
|
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+ update_burst_cache(&p->se.child_burst, p, cnt, sum, now);
|
2024-10-02 18:22:48 +02:00
|
|
|
+}
|
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+static inline u8 inherit_burst_direct(struct task_struct *p, u64 now) {
|
2024-10-02 18:22:48 +02:00
|
|
|
+ struct task_struct *parent = p;
|
2024-10-05 18:13:24 +02:00
|
|
|
+ if (burst_cache_expired(&parent->se.child_burst, now))
|
2024-10-02 18:22:48 +02:00
|
|
|
+ update_child_burst_direct(parent, now);
|
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+ return parent->se.child_burst.score;
|
2024-10-02 18:22:48 +02:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void update_child_burst_topological(
|
|
|
|
+ struct task_struct *p, u64 now, u32 depth, u32 *acnt, u32 *asum) {
|
|
|
|
+ u32 cnt = 0, dcnt = 0, sum = 0;
|
|
|
|
+ struct task_struct *child, *dec;
|
|
|
|
+
|
|
|
|
+ list_for_each_entry(child, &p->children, sibling) {
|
|
|
|
+ dec = child;
|
|
|
|
+ while ((dcnt = count_child_tasks(dec)) == 1)
|
|
|
|
+ dec = list_first_entry(&dec->children, struct task_struct, sibling);
|
|
|
|
+
|
|
|
|
+ if (!dcnt || !depth) {
|
2024-10-05 18:13:24 +02:00
|
|
|
+ if (!task_is_bore_eligible(dec)) continue;
|
2024-10-02 18:22:48 +02:00
|
|
|
+ cnt++;
|
|
|
|
+ sum += dec->se.burst_penalty;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
2024-10-05 18:13:24 +02:00
|
|
|
+ if (!burst_cache_expired(&dec->se.child_burst, now)) {
|
|
|
|
+ cnt += dec->se.child_burst.count;
|
|
|
|
+ sum += (u32)dec->se.child_burst.score * dec->se.child_burst.count;
|
2024-10-02 18:22:48 +02:00
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ update_child_burst_topological(dec, now, depth - 1, &cnt, &sum);
|
|
|
|
+ }
|
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+ update_burst_cache(&p->se.child_burst, p, cnt, sum, now);
|
2024-10-02 18:22:48 +02:00
|
|
|
+ *acnt += cnt;
|
|
|
|
+ *asum += sum;
|
|
|
|
+}
|
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+static inline u8 inherit_burst_topological(struct task_struct *p, u64 now) {
|
2024-10-02 18:22:48 +02:00
|
|
|
+ struct task_struct *anc = p;
|
|
|
|
+ u32 cnt = 0, sum = 0;
|
|
|
|
+
|
|
|
|
+ while (anc->real_parent != anc && count_child_tasks(anc) == 1)
|
|
|
|
+ anc = anc->real_parent;
|
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+ if (burst_cache_expired(&anc->se.child_burst, now))
|
2024-10-02 18:22:48 +02:00
|
|
|
+ update_child_burst_topological(
|
2024-10-05 18:13:24 +02:00
|
|
|
+ anc, now, sched_burst_fork_atavistic - 1, &cnt, &sum);
|
2024-10-02 18:22:48 +02:00
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+ return anc->se.child_burst.score;
|
2024-10-02 18:22:48 +02:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static inline void update_tg_burst(struct task_struct *p, u64 now) {
|
|
|
|
+ struct task_struct *task;
|
|
|
|
+ u32 cnt = 0, sum = 0;
|
|
|
|
+
|
|
|
|
+ for_each_thread(p, task) {
|
2024-10-05 18:13:24 +02:00
|
|
|
+ if (!task_is_bore_eligible(task)) continue;
|
2024-10-02 18:22:48 +02:00
|
|
|
+ cnt++;
|
|
|
|
+ sum += task->se.burst_penalty;
|
|
|
|
+ }
|
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+ update_burst_cache(&p->se.group_burst, p, cnt, sum, now);
|
2024-10-02 18:22:48 +02:00
|
|
|
+}
|
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+static inline u8 inherit_burst_tg(struct task_struct *p, u64 now) {
|
2024-10-02 18:22:48 +02:00
|
|
|
+ struct task_struct *parent = p->group_leader;
|
2024-10-05 18:13:24 +02:00
|
|
|
+ if (burst_cache_expired(&parent->se.group_burst, now))
|
2024-10-02 18:22:48 +02:00
|
|
|
+ update_tg_burst(parent, now);
|
|
|
|
+
|
2024-10-05 18:13:24 +02:00
|
|
|
+ return parent->se.group_burst.score;
|
2024-10-02 18:22:48 +02:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void sched_clone_bore(
|
|
|
|
+ struct task_struct *p, struct task_struct *parent, u64 clone_flags) {
|
2024-10-05 18:13:24 +02:00
|
|
|
+ if (!task_is_bore_eligible(p)) return;
|
2024-10-02 18:22:48 +02:00
|
|
|
+
|
|
|
|
+ u64 now = ktime_get_ns();
|
|
|
|
+ read_lock(&tasklist_lock);
|
2024-10-05 18:13:24 +02:00
|
|
|
+ u8 penalty = (clone_flags & CLONE_THREAD) ?
|
|
|
|
+ inherit_burst_tg(parent, now) :
|
|
|
|
+ likely(sched_burst_fork_atavistic) ?
|
|
|
|
+ inherit_burst_topological(parent, now):
|
|
|
|
+ inherit_burst_direct(parent, now);
|
2024-10-02 18:22:48 +02:00
|
|
|
+ read_unlock(&tasklist_lock);
|
|
|
|
+
|
|
|
|
+ struct sched_entity *se = &p->se;
|
2024-10-05 18:13:24 +02:00
|
|
|
+ revolve_burst_penalty(se);
|
2024-10-02 18:22:48 +02:00
|
|
|
+ se->burst_penalty = se->prev_burst_penalty =
|
|
|
|
+ max(se->prev_burst_penalty, penalty);
|
2024-10-05 18:13:24 +02:00
|
|
|
+ se->child_burst.timestamp = 0;
|
|
|
|
+ se->group_burst.timestamp = 0;
|
2024-10-02 18:22:48 +02:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void init_task_bore(struct task_struct *p) {
|
|
|
|
+ p->se.burst_time = 0;
|
|
|
|
+ p->se.prev_burst_penalty = 0;
|
|
|
|
+ p->se.curr_burst_penalty = 0;
|
|
|
|
+ p->se.burst_penalty = 0;
|
|
|
|
+ p->se.burst_score = 0;
|
2024-10-05 18:13:24 +02:00
|
|
|
+ memset(&p->se.child_burst, 0, sizeof(struct sched_burst_cache));
|
|
|
|
+ memset(&p->se.group_burst, 0, sizeof(struct sched_burst_cache));
|
2024-10-02 18:22:48 +02:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#ifdef CONFIG_SYSCTL
|
|
|
|
+static struct ctl_table sched_bore_sysctls[] = {
|
2024-08-30 15:04:41 +02:00
|
|
|
+ {
|
|
|
|
+ .procname = "sched_bore",
|
|
|
|
+ .data = &sched_bore,
|
|
|
|
+ .maxlen = sizeof(u8),
|
|
|
|
+ .mode = 0644,
|
|
|
|
+ .proc_handler = sched_bore_update_handler,
|
|
|
|
+ .extra1 = SYSCTL_ZERO,
|
|
|
|
+ .extra2 = SYSCTL_ONE,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .procname = "sched_burst_exclude_kthreads",
|
|
|
|
+ .data = &sched_burst_exclude_kthreads,
|
|
|
|
+ .maxlen = sizeof(u8),
|
|
|
|
+ .mode = 0644,
|
|
|
|
+ .proc_handler = proc_dou8vec_minmax,
|
|
|
|
+ .extra1 = SYSCTL_ZERO,
|
|
|
|
+ .extra2 = SYSCTL_ONE,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .procname = "sched_burst_smoothness_long",
|
|
|
|
+ .data = &sched_burst_smoothness_long,
|
|
|
|
+ .maxlen = sizeof(u8),
|
|
|
|
+ .mode = 0644,
|
|
|
|
+ .proc_handler = proc_dou8vec_minmax,
|
|
|
|
+ .extra1 = SYSCTL_ZERO,
|
|
|
|
+ .extra2 = SYSCTL_ONE,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .procname = "sched_burst_smoothness_short",
|
|
|
|
+ .data = &sched_burst_smoothness_short,
|
|
|
|
+ .maxlen = sizeof(u8),
|
|
|
|
+ .mode = 0644,
|
|
|
|
+ .proc_handler = proc_dou8vec_minmax,
|
|
|
|
+ .extra1 = SYSCTL_ZERO,
|
|
|
|
+ .extra2 = SYSCTL_ONE,
|
|
|
|
+ },
|
|
|
|
+ {
|
2024-10-05 18:13:24 +02:00
|
|
|
+ .procname = "sched_burst_fork_atavistic",
|
|
|
|
+ .data = &sched_burst_fork_atavistic,
|
2024-08-30 15:04:41 +02:00
|
|
|
+ .maxlen = sizeof(u8),
|
|
|
|
+ .mode = 0644,
|
|
|
|
+ .proc_handler = proc_dou8vec_minmax,
|
|
|
|
+ .extra1 = SYSCTL_ZERO,
|
|
|
|
+ .extra2 = SYSCTL_THREE,
|
|
|
|
+ },
|
|
|
|
+ {
|
2024-09-20 23:18:02 +02:00
|
|
|
+ .procname = "sched_burst_parity_threshold",
|
|
|
|
+ .data = &sched_burst_parity_threshold,
|
|
|
|
+ .maxlen = sizeof(u8),
|
|
|
|
+ .mode = 0644,
|
|
|
|
+ .proc_handler = proc_dou8vec_minmax,
|
|
|
|
+ .extra1 = SYSCTL_ZERO,
|
|
|
|
+ .extra2 = &maxval_u8,
|
|
|
|
+ },
|
|
|
|
+ {
|
2024-08-30 15:04:41 +02:00
|
|
|
+ .procname = "sched_burst_penalty_offset",
|
|
|
|
+ .data = &sched_burst_penalty_offset,
|
|
|
|
+ .maxlen = sizeof(u8),
|
|
|
|
+ .mode = 0644,
|
|
|
|
+ .proc_handler = proc_dou8vec_minmax,
|
|
|
|
+ .extra1 = SYSCTL_ZERO,
|
|
|
|
+ .extra2 = &sixty_four,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .procname = "sched_burst_penalty_scale",
|
|
|
|
+ .data = &sched_burst_penalty_scale,
|
|
|
|
+ .maxlen = sizeof(uint),
|
|
|
|
+ .mode = 0644,
|
|
|
|
+ .proc_handler = proc_douintvec_minmax,
|
|
|
|
+ .extra1 = SYSCTL_ZERO,
|
|
|
|
+ .extra2 = &maxval_12_bits,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .procname = "sched_burst_cache_lifetime",
|
|
|
|
+ .data = &sched_burst_cache_lifetime,
|
|
|
|
+ .maxlen = sizeof(uint),
|
|
|
|
+ .mode = 0644,
|
|
|
|
+ .proc_handler = proc_douintvec,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .procname = "sched_deadline_boost_mask",
|
|
|
|
+ .data = &sched_deadline_boost_mask,
|
|
|
|
+ .maxlen = sizeof(uint),
|
|
|
|
+ .mode = 0644,
|
|
|
|
+ .proc_handler = proc_douintvec,
|
|
|
|
+ },
|
2024-10-02 18:22:48 +02:00
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static int __init sched_bore_sysctl_init(void) {
|
|
|
|
+ register_sysctl_init("kernel", sched_bore_sysctls);
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+late_initcall(sched_bore_sysctl_init);
|
|
|
|
+#endif // CONFIG_SYSCTL
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
|
2024-11-08 13:08:02 +01:00
|
|
|
index 8ae04bd4a5a4..896db098c4c5 100644
|
2024-10-02 18:22:48 +02:00
|
|
|
--- a/kernel/sched/core.c
|
|
|
|
+++ b/kernel/sched/core.c
|
|
|
|
@@ -97,6 +97,8 @@
|
|
|
|
#include "../../io_uring/io-wq.h"
|
|
|
|
#include "../smpboot.h"
|
|
|
|
|
|
|
|
+#include <linux/sched/bore.h>
|
|
|
|
+
|
|
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(ipi_send_cpu);
|
|
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(ipi_send_cpumask);
|
|
|
|
|
2024-10-10 18:22:46 +02:00
|
|
|
@@ -8290,6 +8292,11 @@ void __init sched_init(void)
|
2024-10-02 18:22:48 +02:00
|
|
|
BUG_ON(!sched_class_above(&ext_sched_class, &idle_sched_class));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
2024-11-08 13:08:02 +01:00
|
|
|
+ printk(KERN_INFO "BORE (Burst-Oriented Response Enhancer) CPU Scheduler modification 5.7.1 by Masahito Suzuki");
|
2024-10-02 18:22:48 +02:00
|
|
|
+ init_task_bore(&init_task);
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
+
|
|
|
|
wait_bit_init();
|
|
|
|
|
|
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
|
|
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
|
2024-11-08 13:08:02 +01:00
|
|
|
index c057ef46c5f8..b71ce5182500 100644
|
2024-10-02 18:22:48 +02:00
|
|
|
--- a/kernel/sched/debug.c
|
|
|
|
+++ b/kernel/sched/debug.c
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -167,7 +167,55 @@ static const struct file_operations sched_feat_fops = {
|
2024-10-02 18:22:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
2024-11-08 13:08:02 +01:00
|
|
|
+#define DEFINE_SYSCTL_SCHED_FUNC(name, update_func) \
|
|
|
|
+static ssize_t sched_##name##_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) \
|
|
|
|
+{ \
|
|
|
|
+ char buf[16]; \
|
|
|
|
+ unsigned int value; \
|
|
|
|
+\
|
|
|
|
+ if (cnt > 15) \
|
|
|
|
+ cnt = 15; \
|
|
|
|
+\
|
|
|
|
+ if (copy_from_user(&buf, ubuf, cnt)) \
|
|
|
|
+ return -EFAULT; \
|
|
|
|
+ buf[cnt] = '\0'; \
|
|
|
|
+\
|
|
|
|
+ if (kstrtouint(buf, 10, &value)) \
|
|
|
|
+ return -EINVAL; \
|
|
|
|
+\
|
|
|
|
+ sysctl_sched_##name = value; \
|
|
|
|
+ sched_update_##update_func(); \
|
|
|
|
+\
|
|
|
|
+ *ppos += cnt; \
|
|
|
|
+ return cnt; \
|
|
|
|
+} \
|
|
|
|
+\
|
|
|
|
+static int sched_##name##_show(struct seq_file *m, void *v) \
|
|
|
|
+{ \
|
|
|
|
+ seq_printf(m, "%d\n", sysctl_sched_##name); \
|
|
|
|
+ return 0; \
|
|
|
|
+} \
|
|
|
|
+\
|
|
|
|
+static int sched_##name##_open(struct inode *inode, struct file *filp) \
|
|
|
|
+{ \
|
|
|
|
+ return single_open(filp, sched_##name##_show, NULL); \
|
|
|
|
+} \
|
|
|
|
+\
|
|
|
|
+static const struct file_operations sched_##name##_fops = { \
|
|
|
|
+ .open = sched_##name##_open, \
|
|
|
|
+ .write = sched_##name##_write, \
|
|
|
|
+ .read = seq_read, \
|
|
|
|
+ .llseek = seq_lseek, \
|
|
|
|
+ .release = single_release, \
|
|
|
|
+};
|
2024-10-02 18:22:48 +02:00
|
|
|
+
|
2024-11-08 13:08:02 +01:00
|
|
|
+DEFINE_SYSCTL_SCHED_FUNC(min_base_slice, min_base_slice)
|
|
|
|
+DEFINE_SYSCTL_SCHED_FUNC(migration_cost_base, migration_cost)
|
|
|
|
+DEFINE_SYSCTL_SCHED_FUNC(migration_cost_step, migration_cost)
|
2024-10-02 18:22:48 +02:00
|
|
|
|
2024-11-08 13:08:02 +01:00
|
|
|
+#undef DEFINE_SYSCTL_SCHED_FUNC
|
2024-10-02 18:22:48 +02:00
|
|
|
+#else // !CONFIG_SCHED_BORE
|
|
|
|
static ssize_t sched_scaling_write(struct file *filp, const char __user *ubuf,
|
|
|
|
size_t cnt, loff_t *ppos)
|
|
|
|
{
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -213,7 +261,7 @@ static const struct file_operations sched_scaling_fops = {
|
2024-10-02 18:22:48 +02:00
|
|
|
.llseek = seq_lseek,
|
|
|
|
.release = single_release,
|
|
|
|
};
|
|
|
|
-
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
#endif /* SMP */
|
|
|
|
|
|
|
|
#ifdef CONFIG_PREEMPT_DYNAMIC
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -347,14 +395,25 @@ static __init int sched_init_debug(void)
|
2024-10-02 18:22:48 +02:00
|
|
|
debugfs_create_file("preempt", 0644, debugfs_sched, NULL, &sched_dynamic_fops);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+ debugfs_create_file("min_base_slice_ns", 0644, debugfs_sched, NULL, &sched_min_base_slice_fops);
|
2024-11-08 13:08:02 +01:00
|
|
|
+ debugfs_create_u32("base_slice_ns", 0444, debugfs_sched, &sysctl_sched_base_slice);
|
2024-10-02 18:22:48 +02:00
|
|
|
+#else // !CONFIG_SCHED_BORE
|
|
|
|
debugfs_create_u32("base_slice_ns", 0644, debugfs_sched, &sysctl_sched_base_slice);
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
|
|
|
|
debugfs_create_u32("latency_warn_ms", 0644, debugfs_sched, &sysctl_resched_latency_warn_ms);
|
|
|
|
debugfs_create_u32("latency_warn_once", 0644, debugfs_sched, &sysctl_resched_latency_warn_once);
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
2024-11-08 13:08:02 +01:00
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+ debugfs_create_file("migration_cost_base_ns", 0644, debugfs_sched, NULL, &sched_migration_cost_base_fops);
|
|
|
|
+ debugfs_create_file("migration_cost_step_ns", 0644, debugfs_sched, NULL, &sched_migration_cost_step_fops);
|
|
|
|
+ debugfs_create_u32("migration_cost_ns", 0444, debugfs_sched, &sysctl_sched_migration_cost);
|
|
|
|
+#else // !CONFIG_SCHED_BORE
|
2024-10-02 18:22:48 +02:00
|
|
|
debugfs_create_file("tunable_scaling", 0644, debugfs_sched, NULL, &sched_scaling_fops);
|
|
|
|
debugfs_create_u32("migration_cost_ns", 0644, debugfs_sched, &sysctl_sched_migration_cost);
|
2024-11-08 13:08:02 +01:00
|
|
|
+#endif // CONFIG_SCHED_BORE
|
2024-10-02 18:22:48 +02:00
|
|
|
debugfs_create_u32("nr_migrate", 0644, debugfs_sched, &sysctl_sched_nr_migrate);
|
|
|
|
|
2024-11-08 13:08:02 +01:00
|
|
|
mutex_lock(&sched_domains_mutex);
|
|
|
|
@@ -596,6 +655,9 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
|
2024-10-02 18:22:48 +02:00
|
|
|
SPLIT_NS(schedstat_val_or_zero(p->stats.sum_sleep_runtime)),
|
|
|
|
SPLIT_NS(schedstat_val_or_zero(p->stats.sum_block_runtime)));
|
|
|
|
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+ SEQ_printf(m, " %2d", p->se.burst_score);
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
#ifdef CONFIG_NUMA_BALANCING
|
|
|
|
SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p));
|
|
|
|
#endif
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -1069,6 +1131,9 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
|
2024-10-02 18:22:48 +02:00
|
|
|
|
|
|
|
P(se.load.weight);
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+ P(se.burst_score);
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
P(se.avg.load_sum);
|
|
|
|
P(se.avg.runnable_sum);
|
|
|
|
P(se.avg.util_sum);
|
|
|
|
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
|
2024-11-08 13:08:02 +01:00
|
|
|
index a36e37a674e8..bdd7366db711 100644
|
2024-10-02 18:22:48 +02:00
|
|
|
--- a/kernel/sched/fair.c
|
|
|
|
+++ b/kernel/sched/fair.c
|
|
|
|
@@ -55,6 +55,8 @@
|
|
|
|
#include "stats.h"
|
|
|
|
#include "autogroup.h"
|
|
|
|
|
|
|
|
+#include <linux/sched/bore.h>
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* The initial- and re-scaling of tunables is configurable
|
|
|
|
*
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -64,28 +66,38 @@
|
2024-10-02 18:22:48 +02:00
|
|
|
* SCHED_TUNABLESCALING_LOG - scaled logarithmically, *1+ilog(ncpus)
|
|
|
|
* SCHED_TUNABLESCALING_LINEAR - scaled linear, *ncpus
|
|
|
|
*
|
|
|
|
- * (default SCHED_TUNABLESCALING_LOG = *(1+ilog(ncpus))
|
2024-11-08 13:08:02 +01:00
|
|
|
+ * BORE : default SCHED_TUNABLESCALING_NONE = *1 constant
|
|
|
|
+ * EEVDF: default SCHED_TUNABLESCALING_LOG = *(1+ilog(ncpus))
|
2024-10-02 18:22:48 +02:00
|
|
|
*/
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+unsigned int sysctl_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
|
|
|
|
+#else // !CONFIG_SCHED_BORE
|
|
|
|
unsigned int sysctl_sched_tunable_scaling = SCHED_TUNABLESCALING_LOG;
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Minimal preemption granularity for CPU-bound tasks:
|
|
|
|
*
|
|
|
|
- * (default: 0.75 msec * (1 + ilog(ncpus)), units: nanoseconds)
|
2024-11-08 13:08:02 +01:00
|
|
|
+ * BORE : base_slice = minimum multiple of nsecs_per_tick >= min_base_slice
|
|
|
|
+ * (default min_base_slice = 2000000 constant, units: nanoseconds)
|
|
|
|
+ * EEVDF: default 0.75 msec * (1 + ilog(ncpus)), units: nanoseconds
|
2024-10-02 18:22:48 +02:00
|
|
|
*/
|
|
|
|
-#ifdef CONFIG_CACHY
|
|
|
|
-unsigned int sysctl_sched_base_slice = 350000ULL;
|
|
|
|
-static unsigned int normalized_sysctl_sched_base_slice = 350000ULL;
|
|
|
|
-#else
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
2024-11-08 13:08:02 +01:00
|
|
|
+const static uint nsecs_per_tick = 1000000000ULL / HZ;
|
|
|
|
+const_debug uint sysctl_sched_min_base_slice = CONFIG_MIN_BASE_SLICE_NS;
|
|
|
|
+__read_mostly uint sysctl_sched_base_slice = nsecs_per_tick;
|
2024-10-02 18:22:48 +02:00
|
|
|
+#else // !CONFIG_SCHED_BORE
|
|
|
|
unsigned int sysctl_sched_base_slice = 750000ULL;
|
|
|
|
static unsigned int normalized_sysctl_sched_base_slice = 750000ULL;
|
|
|
|
-#endif
|
2024-08-30 15:04:41 +02:00
|
|
|
+#endif // CONFIG_SCHED_BORE
|
2024-10-02 18:22:48 +02:00
|
|
|
|
|
|
|
-#ifdef CONFIG_CACHY
|
|
|
|
-const_debug unsigned int sysctl_sched_migration_cost = 300000UL;
|
|
|
|
-#else
|
2024-11-08 13:08:02 +01:00
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+const_debug uint sysctl_sched_migration_cost_base = CONFIG_MIGRATION_COST_BASE_NS;
|
|
|
|
+const_debug uint sysctl_sched_migration_cost_step = CONFIG_MIGRATION_COST_STEP_NS;
|
|
|
|
+__read_mostly uint sysctl_sched_migration_cost = CONFIG_MIGRATION_COST_BASE_NS;
|
|
|
|
+#else // !CONFIG_SCHED_BORE
|
2024-10-02 18:22:48 +02:00
|
|
|
const_debug unsigned int sysctl_sched_migration_cost = 500000UL;
|
|
|
|
-#endif
|
2024-11-08 13:08:02 +01:00
|
|
|
+#endif // CONFIG_SCHED_BORE
|
2024-10-02 18:22:48 +02:00
|
|
|
|
|
|
|
static int __init setup_sched_thermal_decay_shift(char *str)
|
|
|
|
{
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -130,12 +142,8 @@ int __weak arch_asym_cpu_priority(int cpu)
|
2024-10-02 18:22:48 +02:00
|
|
|
*
|
|
|
|
* (default: 5 msec, units: microseconds)
|
|
|
|
*/
|
|
|
|
-#ifdef CONFIG_CACHY
|
|
|
|
-static unsigned int sysctl_sched_cfs_bandwidth_slice = 3000UL;
|
|
|
|
-#else
|
|
|
|
static unsigned int sysctl_sched_cfs_bandwidth_slice = 5000UL;
|
|
|
|
#endif
|
|
|
|
-#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_NUMA_BALANCING
|
|
|
|
/* Restrict the NUMA promotion throughput (MB/s) for each target node. */
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -201,6 +209,18 @@ static inline void update_load_set(struct load_weight *lw, unsigned long w)
|
2024-08-30 15:04:41 +02:00
|
|
|
*
|
|
|
|
* This idea comes from the SD scheduler of Con Kolivas:
|
|
|
|
*/
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
2024-11-08 13:08:02 +01:00
|
|
|
+static void auto_calculate_base_slice(void) {
|
|
|
|
+ sysctl_sched_base_slice = nsecs_per_tick *
|
|
|
|
+ max(1UL, DIV_ROUND_UP(sysctl_sched_min_base_slice, nsecs_per_tick));
|
|
|
|
+}
|
|
|
|
+static void auto_calculate_migration_cost(void) {
|
|
|
|
+ sysctl_sched_migration_cost = sysctl_sched_migration_cost_base +
|
|
|
|
+ ilog2(num_online_cpus()) * sysctl_sched_migration_cost_step;
|
2024-08-30 15:04:41 +02:00
|
|
|
+}
|
2024-11-08 13:08:02 +01:00
|
|
|
+void sched_update_min_base_slice(void) { auto_calculate_base_slice(); }
|
|
|
|
+void sched_update_migration_cost(void) { auto_calculate_migration_cost(); }
|
2024-08-30 15:04:41 +02:00
|
|
|
+#else // !CONFIG_SCHED_BORE
|
|
|
|
static unsigned int get_update_sysctl_factor(void)
|
|
|
|
{
|
|
|
|
unsigned int cpus = min_t(unsigned int, num_online_cpus(), 8);
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -221,15 +241,21 @@ static unsigned int get_update_sysctl_factor(void)
|
|
|
|
|
|
|
|
return factor;
|
|
|
|
}
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
|
|
|
|
static void update_sysctl(void)
|
|
|
|
{
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+ auto_calculate_base_slice();
|
|
|
|
+ auto_calculate_migration_cost();
|
|
|
|
+#else // !CONFIG_SCHED_BORE
|
|
|
|
unsigned int factor = get_update_sysctl_factor();
|
|
|
|
|
|
|
|
#define SET_SYSCTL(name) \
|
|
|
|
(sysctl_##name = (factor) * normalized_sysctl_##name)
|
2024-08-30 15:04:41 +02:00
|
|
|
SET_SYSCTL(sched_base_slice);
|
|
|
|
#undef SET_SYSCTL
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
2024-11-08 13:08:02 +01:00
|
|
|
}
|
2024-08-30 15:04:41 +02:00
|
|
|
|
|
|
|
void __init sched_init_granularity(void)
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -708,6 +734,9 @@ static s64 entity_lag(u64 avruntime, struct sched_entity *se)
|
2024-08-30 15:04:41 +02:00
|
|
|
|
|
|
|
vlag = avruntime - se->vruntime;
|
|
|
|
limit = calc_delta_fair(max_t(u64, 2*se->slice, TICK_NSEC), se);
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
2024-09-16 14:10:53 +02:00
|
|
|
+ limit >>= !!sched_bore;
|
2024-08-30 15:04:41 +02:00
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
|
|
|
|
return clamp(vlag, -limit, limit);
|
|
|
|
}
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -909,6 +938,10 @@ static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq)
|
2024-10-02 18:22:48 +02:00
|
|
|
* until it gets a new slice. See the HACK in set_next_entity().
|
|
|
|
*/
|
|
|
|
if (sched_feat(RUN_TO_PARITY) && curr && curr->vlag == curr->deadline)
|
2024-09-20 23:18:02 +02:00
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
2024-10-02 18:22:48 +02:00
|
|
|
+ if (!(likely(sched_bore) && likely(sched_burst_parity_threshold) &&
|
|
|
|
+ sched_burst_parity_threshold < cfs_rq->nr_running))
|
2024-09-20 23:18:02 +02:00
|
|
|
+#endif // CONFIG_SCHED_BORE
|
2024-08-30 15:04:41 +02:00
|
|
|
return curr;
|
|
|
|
|
|
|
|
/* Pick the leftmost entity if it's eligible */
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -967,6 +1000,7 @@ struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
|
2024-08-30 15:04:41 +02:00
|
|
|
* Scheduling class statistics methods:
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
+#if !defined(CONFIG_SCHED_BORE)
|
|
|
|
int sched_update_scaling(void)
|
|
|
|
{
|
|
|
|
unsigned int factor = get_update_sysctl_factor();
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -978,6 +1012,7 @@ int sched_update_scaling(void)
|
2024-08-30 15:04:41 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -1178,6 +1213,10 @@ static void update_curr(struct cfs_rq *cfs_rq)
|
2024-08-30 15:04:41 +02:00
|
|
|
if (unlikely(delta_exec <= 0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+ curr->burst_time += delta_exec;
|
|
|
|
+ update_burst_penalty(curr);
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
curr->vruntime += calc_delta_fair(delta_exec, curr);
|
|
|
|
update_deadline(cfs_rq, curr);
|
|
|
|
update_min_vruntime(cfs_rq);
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -3804,7 +3843,7 @@ static void reweight_eevdf(struct sched_entity *se, u64 avruntime,
|
2024-10-02 18:22:48 +02:00
|
|
|
se->deadline = avruntime + vslice;
|
|
|
|
}
|
2024-08-30 15:04:41 +02:00
|
|
|
|
2024-10-02 18:22:48 +02:00
|
|
|
-static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
|
|
|
|
+void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
|
|
|
|
unsigned long weight)
|
|
|
|
{
|
|
|
|
bool curr = cfs_rq->curr == se;
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -5212,6 +5251,9 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
|
2024-08-30 15:04:41 +02:00
|
|
|
*
|
|
|
|
* EEVDF: placement strategy #1 / #2
|
|
|
|
*/
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+ if (se->vlag)
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
if (sched_feat(PLACE_LAG) && cfs_rq->nr_running) {
|
|
|
|
struct sched_entity *curr = cfs_rq->curr;
|
|
|
|
unsigned long load;
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -5282,6 +5324,16 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
|
2024-10-02 18:22:48 +02:00
|
|
|
|
|
|
|
se->vruntime = vruntime - lag;
|
|
|
|
|
|
|
|
+ if (sched_feat(PLACE_REL_DEADLINE) && se->rel_deadline) {
|
|
|
|
+ se->deadline += se->vruntime;
|
|
|
|
+ se->rel_deadline = 0;
|
|
|
|
+ return;
|
|
|
|
+ }
|
2024-08-30 15:04:41 +02:00
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
2024-10-05 18:13:24 +02:00
|
|
|
+ else if (likely(sched_bore))
|
|
|
|
+ vslice >>= !!(flags & sched_deadline_boost_mask);
|
2024-08-30 15:04:41 +02:00
|
|
|
+ else
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
2024-10-02 18:22:48 +02:00
|
|
|
/*
|
|
|
|
* When joining the competition; the existing tasks will be,
|
|
|
|
* on average, halfway through their slice, as such start tasks
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -5391,6 +5443,7 @@ static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq);
|
2024-10-02 18:22:48 +02:00
|
|
|
static void
|
|
|
|
dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
|
|
|
|
{
|
|
|
|
+ bool sleep = flags & DEQUEUE_SLEEP;
|
|
|
|
int action = UPDATE_TG;
|
2024-08-30 15:04:41 +02:00
|
|
|
|
2024-10-02 18:22:48 +02:00
|
|
|
if (entity_is_task(se) && task_on_rq_migrating(task_of(se)))
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -5418,6 +5471,11 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
|
2024-10-02 18:22:48 +02:00
|
|
|
clear_buddies(cfs_rq, se);
|
2024-08-30 15:04:41 +02:00
|
|
|
|
2024-10-02 18:22:48 +02:00
|
|
|
update_entity_lag(cfs_rq, se);
|
|
|
|
+ if (sched_feat(PLACE_REL_DEADLINE) && !sleep) {
|
|
|
|
+ se->deadline -= se->vruntime;
|
|
|
|
+ se->rel_deadline = 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (se != cfs_rq->curr)
|
|
|
|
__dequeue_entity(cfs_rq, se);
|
|
|
|
se->on_rq = 0;
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -6869,6 +6927,14 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)
|
2024-08-30 15:04:41 +02:00
|
|
|
bool was_sched_idle = sched_idle_rq(rq);
|
|
|
|
|
|
|
|
util_est_dequeue(&rq->cfs, p);
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+ if (task_sleep) {
|
|
|
|
+ cfs_rq = cfs_rq_of(se);
|
|
|
|
+ if (cfs_rq->curr == se)
|
|
|
|
+ update_curr(cfs_rq);
|
|
|
|
+ restart_burst(se);
|
|
|
|
+ }
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
|
|
|
|
for_each_sched_entity(se) {
|
|
|
|
cfs_rq = cfs_rq_of(se);
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -8651,16 +8717,25 @@ static void yield_task_fair(struct rq *rq)
|
2024-08-30 15:04:41 +02:00
|
|
|
/*
|
|
|
|
* Are we the only task in the tree?
|
|
|
|
*/
|
|
|
|
+#if !defined(CONFIG_SCHED_BORE)
|
|
|
|
if (unlikely(rq->nr_running == 1))
|
|
|
|
return;
|
|
|
|
|
|
|
|
clear_buddies(cfs_rq, se);
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
|
|
|
|
update_rq_clock(rq);
|
|
|
|
/*
|
|
|
|
* Update run-time statistics of the 'current'.
|
|
|
|
*/
|
|
|
|
update_curr(cfs_rq);
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+ restart_burst_rescale_deadline(se);
|
|
|
|
+ if (unlikely(rq->nr_running == 1))
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ clear_buddies(cfs_rq, se);
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
/*
|
|
|
|
* Tell update_rq_clock() that we've just updated,
|
|
|
|
* so we don't do microscopic update in schedule()
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -12725,6 +12800,9 @@ static void task_fork_fair(struct task_struct *p)
|
2024-08-30 15:04:41 +02:00
|
|
|
curr = cfs_rq->curr;
|
|
|
|
if (curr)
|
|
|
|
update_curr(cfs_rq);
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+ update_burst_score(se);
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
place_entity(cfs_rq, se, ENQUEUE_INITIAL);
|
|
|
|
rq_unlock(rq, &rf);
|
|
|
|
}
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -12837,6 +12915,10 @@ static void attach_task_cfs_rq(struct task_struct *p)
|
2024-10-02 18:22:48 +02:00
|
|
|
|
|
|
|
static void switched_from_fair(struct rq *rq, struct task_struct *p)
|
|
|
|
{
|
|
|
|
+ p->se.rel_deadline = 0;
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+ init_task_bore(p);
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
detach_task_cfs_rq(p);
|
|
|
|
}
|
|
|
|
|
2024-08-30 15:04:41 +02:00
|
|
|
diff --git a/kernel/sched/features.h b/kernel/sched/features.h
|
2024-10-05 18:13:24 +02:00
|
|
|
index 143f55df890b..e97b7b68bdd3 100644
|
2024-08-30 15:04:41 +02:00
|
|
|
--- a/kernel/sched/features.h
|
|
|
|
+++ b/kernel/sched/features.h
|
2024-10-02 18:22:48 +02:00
|
|
|
@@ -6,6 +6,10 @@
|
2024-08-30 15:04:41 +02:00
|
|
|
*/
|
|
|
|
SCHED_FEAT(PLACE_LAG, true)
|
|
|
|
SCHED_FEAT(PLACE_DEADLINE_INITIAL, true)
|
|
|
|
+/*
|
2024-10-02 18:22:48 +02:00
|
|
|
+ * Preserve relative virtual deadline on 'migration'.
|
2024-08-30 15:04:41 +02:00
|
|
|
+ */
|
2024-10-02 18:22:48 +02:00
|
|
|
+SCHED_FEAT(PLACE_REL_DEADLINE, true)
|
|
|
|
SCHED_FEAT(RUN_TO_PARITY, true)
|
2024-08-30 15:04:41 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
|
2024-11-08 13:08:02 +01:00
|
|
|
index 48d893de632b..8c3fa2ffa177 100644
|
2024-08-30 15:04:41 +02:00
|
|
|
--- a/kernel/sched/sched.h
|
|
|
|
+++ b/kernel/sched/sched.h
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -2065,7 +2065,12 @@ static inline void update_sched_domain_debugfs(void) { }
|
2024-08-30 15:04:41 +02:00
|
|
|
static inline void dirty_sched_domain_sysctl(int cpu) { }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+extern void sched_update_min_base_slice(void);
|
2024-11-08 13:08:02 +01:00
|
|
|
+extern void sched_update_migration_cost(void);
|
2024-08-30 15:04:41 +02:00
|
|
|
+#else // !CONFIG_SCHED_BORE
|
|
|
|
extern int sched_update_scaling(void);
|
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
|
|
|
|
static inline const struct cpumask *task_user_cpus(struct task_struct *p)
|
|
|
|
{
|
2024-11-08 13:08:02 +01:00
|
|
|
@@ -2735,9 +2740,20 @@ extern void wakeup_preempt(struct rq *rq, struct task_struct *p, int flags);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern const_debug unsigned int sysctl_sched_nr_migrate;
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
|
|
|
+extern const_debug unsigned int sysctl_sched_migration_cost_base;
|
|
|
|
+extern const_debug unsigned int sysctl_sched_migration_cost_step;
|
|
|
|
+extern __read_mostly unsigned int sysctl_sched_migration_cost;
|
|
|
|
+#else // !CONFIG_SCHED_BORE
|
2024-08-30 15:04:41 +02:00
|
|
|
extern const_debug unsigned int sysctl_sched_migration_cost;
|
2024-11-08 13:08:02 +01:00
|
|
|
+#endif // CONFIG_SCHED_BORE
|
2024-08-30 15:04:41 +02:00
|
|
|
|
|
|
|
+#ifdef CONFIG_SCHED_BORE
|
2024-11-08 13:08:02 +01:00
|
|
|
+extern const_debug unsigned int sysctl_sched_min_base_slice;
|
|
|
|
+extern __read_mostly unsigned int sysctl_sched_base_slice;
|
|
|
|
+#else // !CONFIG_SCHED_BORE
|
|
|
|
extern unsigned int sysctl_sched_base_slice;
|
2024-08-30 15:04:41 +02:00
|
|
|
+#endif // CONFIG_SCHED_BORE
|
|
|
|
|
|
|
|
#ifdef CONFIG_SCHED_DEBUG
|
|
|
|
extern int sysctl_resched_latency_warn_ms;
|
|
|
|
--
|
2024-10-10 18:22:46 +02:00
|
|
|
2.47.0
|
2024-11-08 13:08:02 +01:00
|
|
|
|