This commit is contained in:
ferrreo 2024-04-03 17:43:13 +01:00
parent dc067eaadb
commit 0299c8b1ea
6 changed files with 10766 additions and 1259 deletions

View File

@ -1 +1 @@
6.8.1 6.8.3

14
config
View File

@ -1,6 +1,6 @@
# #
# Automatically generated file; DO NOT EDIT. # Automatically generated file; DO NOT EDIT.
# Linux/x86 6.8.1 Kernel Configuration # Linux/x86 6.8.3 Kernel Configuration
# #
CONFIG_CC_VERSION_TEXT="gcc (GCC) 13.2.1 20230801" CONFIG_CC_VERSION_TEXT="gcc (GCC) 13.2.1 20230801"
CONFIG_CC_IS_GCC=y CONFIG_CC_IS_GCC=y
@ -24,6 +24,7 @@ CONFIG_PAHOLE_VERSION=126
CONFIG_IRQ_WORK=y CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_TABLE_SORT=y CONFIG_BUILDTIME_TABLE_SORT=y
CONFIG_THREAD_INFO_IN_TASK=y CONFIG_THREAD_INFO_IN_TASK=y
# CONFIG_ECHO_SCHED is not set
# #
# General setup # General setup
@ -518,7 +519,6 @@ CONFIG_X86_DIRECT_GBPAGES=y
CONFIG_X86_CPA_STATISTICS=y CONFIG_X86_CPA_STATISTICS=y
CONFIG_X86_MEM_ENCRYPT=y CONFIG_X86_MEM_ENCRYPT=y
CONFIG_AMD_MEM_ENCRYPT=y CONFIG_AMD_MEM_ENCRYPT=y
# CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT is not set
CONFIG_NUMA=y CONFIG_NUMA=y
CONFIG_AMD_NUMA=y CONFIG_AMD_NUMA=y
CONFIG_X86_64_ACPI_NUMA=y CONFIG_X86_64_ACPI_NUMA=y
@ -561,6 +561,7 @@ CONFIG_HZ_300=y
# CONFIG_HZ_500 is not set # CONFIG_HZ_500 is not set
# CONFIG_HZ_600 is not set # CONFIG_HZ_600 is not set
# CONFIG_HZ_750 is not set # CONFIG_HZ_750 is not set
# CONFIG_HZ_625 is not set
# CONFIG_HZ_1000 is not set # CONFIG_HZ_1000 is not set
CONFIG_HZ=300 CONFIG_HZ=300
CONFIG_SCHED_HRTICK=y CONFIG_SCHED_HRTICK=y
@ -836,6 +837,8 @@ CONFIG_AS_SHA1_NI=y
CONFIG_AS_SHA256_NI=y CONFIG_AS_SHA256_NI=y
CONFIG_AS_TPAUSE=y CONFIG_AS_TPAUSE=y
CONFIG_AS_GFNI=y CONFIG_AS_GFNI=y
CONFIG_AS_VAES=y
CONFIG_AS_VPCLMULQDQ=y
CONFIG_AS_WRUSS=y CONFIG_AS_WRUSS=y
# #
@ -1024,6 +1027,7 @@ CONFIG_MODULE_SRCVERSION_ALL=y
CONFIG_MODULE_SIG=y CONFIG_MODULE_SIG=y
# CONFIG_MODULE_SIG_FORCE is not set # CONFIG_MODULE_SIG_FORCE is not set
CONFIG_MODULE_SIG_ALL=y CONFIG_MODULE_SIG_ALL=y
# CONFIG_MODULE_SIG_SHA1 is not set
# CONFIG_MODULE_SIG_SHA256 is not set # CONFIG_MODULE_SIG_SHA256 is not set
# CONFIG_MODULE_SIG_SHA384 is not set # CONFIG_MODULE_SIG_SHA384 is not set
CONFIG_MODULE_SIG_SHA512=y CONFIG_MODULE_SIG_SHA512=y
@ -2053,7 +2057,6 @@ CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_CMTP=m CONFIG_BT_CMTP=m
CONFIG_BT_HIDP=m CONFIG_BT_HIDP=m
# CONFIG_BT_HS is not set
CONFIG_BT_LE=y CONFIG_BT_LE=y
CONFIG_BT_LE_L2CAP_ECRED=y CONFIG_BT_LE_L2CAP_ECRED=y
CONFIG_BT_6LOWPAN=m CONFIG_BT_6LOWPAN=m
@ -6867,6 +6870,7 @@ CONFIG_DRM_AMD_DC=y
CONFIG_DRM_AMD_DC_FP=y CONFIG_DRM_AMD_DC_FP=y
CONFIG_DRM_AMD_DC_SI=y CONFIG_DRM_AMD_DC_SI=y
CONFIG_DRM_AMD_SECURE_DISPLAY=y CONFIG_DRM_AMD_SECURE_DISPLAY=y
CONFIG_AMD_PRIVATE_COLOR=y
# end of Display Engine Configuration # end of Display Engine Configuration
CONFIG_HSA_AMD=y CONFIG_HSA_AMD=y
@ -10944,7 +10948,8 @@ CONFIG_ASYNC_XOR=m
CONFIG_ASYNC_PQ=m CONFIG_ASYNC_PQ=m
CONFIG_ASYNC_RAID6_RECOV=m CONFIG_ASYNC_RAID6_RECOV=m
CONFIG_CRYPTO=y CONFIG_CRYPTO=y
CONFIG_NTSYNC=m
CONFIG_ACPI_CALL=m
# #
# Crypto core or helper # Crypto core or helper
# #
@ -11808,6 +11813,7 @@ CONFIG_ASYNC_RAID6_TEST=m
# CONFIG_TEST_OBJPOOL is not set # CONFIG_TEST_OBJPOOL is not set
CONFIG_ARCH_USE_MEMTEST=y CONFIG_ARCH_USE_MEMTEST=y
CONFIG_MEMTEST=y CONFIG_MEMTEST=y
# CONFIG_HYPERV_TESTING is not set # CONFIG_HYPERV_TESTING is not set
# end of Kernel Testing and Coverage # end of Kernel Testing and Coverage

View File

@ -1,24 +1,24 @@
From 1ab81cfa061f454316364a32761ce45a7479e616 Mon Sep 17 00:00:00 2001 From 37fd243d8f075b558f54a36fc85887269310709c Mon Sep 17 00:00:00 2001
From: Piotr Gorski <lucjan.lucjanov@gmail.com> From: Piotr Gorski <lucjan.lucjanov@gmail.com>
Date: Thu, 7 Mar 2024 22:28:47 +0100 Date: Tue, 26 Mar 2024 08:11:18 +0100
Subject: [PATCH] bore-cachy Subject: [PATCH] bore-cachy
Signed-off-by: Piotr Gorski <lucjan.lucjanov@gmail.com> Signed-off-by: Piotr Gorski <lucjan.lucjanov@gmail.com>
--- ---
include/linux/sched.h | 12 ++ include/linux/sched.h | 10 ++
init/Kconfig | 19 +++ init/Kconfig | 17 +++
kernel/sched/core.c | 148 +++++++++++++++++++ kernel/sched/core.c | 144 +++++++++++++++++++++++++
kernel/sched/debug.c | 61 +++++++- kernel/sched/debug.c | 60 ++++++++++-
kernel/sched/fair.c | 319 ++++++++++++++++++++++++++++++++++++---- kernel/sched/fair.c | 231 +++++++++++++++++++++++++++++++++++++---
kernel/sched/features.h | 4 + kernel/sched/features.h | 4 +
kernel/sched/sched.h | 7 + kernel/sched/sched.h | 7 ++
7 files changed, 542 insertions(+), 28 deletions(-) 7 files changed, 457 insertions(+), 16 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h diff --git a/include/linux/sched.h b/include/linux/sched.h
index ffe8f618a..7ac6163f9 100644 index ffe8f618a..0ab0b0424 100644
--- a/include/linux/sched.h --- a/include/linux/sched.h
+++ b/include/linux/sched.h +++ b/include/linux/sched.h
@@ -547,6 +547,18 @@ struct sched_entity { @@ -547,6 +547,16 @@ struct sched_entity {
u64 sum_exec_runtime; u64 sum_exec_runtime;
u64 prev_sum_exec_runtime; u64 prev_sum_exec_runtime;
u64 vruntime; u64 vruntime;
@ -28,8 +28,6 @@ index ffe8f618a..7ac6163f9 100644
+ u8 curr_burst_penalty; + u8 curr_burst_penalty;
+ u8 burst_penalty; + u8 burst_penalty;
+ u8 burst_score; + u8 burst_score;
+ u32 burst_load;
+ bool on_cfs_rq;
+ u8 child_burst; + u8 child_burst;
+ u32 child_burst_cnt; + u32 child_burst_cnt;
+ u64 child_burst_last_cached; + u64 child_burst_last_cached;
@ -38,10 +36,10 @@ index ffe8f618a..7ac6163f9 100644
u64 slice; u64 slice;
diff --git a/init/Kconfig b/init/Kconfig diff --git a/init/Kconfig b/init/Kconfig
index 47671886d..c99132cf6 100644 index 9ea39297f..f9bb5401f 100644
--- a/init/Kconfig --- a/init/Kconfig
+++ b/init/Kconfig +++ b/init/Kconfig
@@ -1299,6 +1299,25 @@ config CHECKPOINT_RESTORE @@ -1299,6 +1299,23 @@ config CHECKPOINT_RESTORE
If unsure, say N here. If unsure, say N here.
@ -60,18 +58,16 @@ index 47671886d..c99132cf6 100644
+ With a little impact to scheduling fairness, it may improve + With a little impact to scheduling fairness, it may improve
+ responsiveness especially under heavy background workload. + responsiveness especially under heavy background workload.
+ +
+ You can turn it off by setting the sysctl kernel.sched_bore = 0.
+
+ If unsure, say Y here. + If unsure, say Y here.
+ +
config SCHED_AUTOGROUP config SCHED_AUTOGROUP
bool "Automatic process group scheduling" bool "Automatic process group scheduling"
select CGROUPS select CGROUPS
diff --git a/kernel/sched/core.c b/kernel/sched/core.c diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9116bcc90..43e4311db 100644 index 9116bcc90..fc3d7b48e 100644
--- a/kernel/sched/core.c --- a/kernel/sched/core.c
+++ b/kernel/sched/core.c +++ b/kernel/sched/core.c
@@ -4507,6 +4507,143 @@ int wake_up_state(struct task_struct *p, unsigned int state) @@ -4507,6 +4507,139 @@ int wake_up_state(struct task_struct *p, unsigned int state)
return try_to_wake_up(p, state, 0); return try_to_wake_up(p, state, 0);
} }
@ -86,18 +82,14 @@ index 9116bcc90..43e4311db 100644
+ init_task.se.curr_burst_penalty = 0; + init_task.se.curr_burst_penalty = 0;
+ init_task.se.burst_penalty = 0; + init_task.se.burst_penalty = 0;
+ init_task.se.burst_score = 0; + init_task.se.burst_score = 0;
+ init_task.se.on_cfs_rq = false;
+ init_task.se.child_burst_last_cached = 0; + init_task.se.child_burst_last_cached = 0;
+ init_task.se.burst_load = 0;
+} +}
+ +
+void inline sched_fork_bore(struct task_struct *p) { +void inline sched_fork_bore(struct task_struct *p) {
+ p->se.burst_time = 0; + p->se.burst_time = 0;
+ p->se.curr_burst_penalty = 0; + p->se.curr_burst_penalty = 0;
+ p->se.burst_score = 0; + p->se.burst_score = 0;
+ p->se.on_cfs_rq = false;
+ p->se.child_burst_last_cached = 0; + p->se.child_burst_last_cached = 0;
+ p->se.burst_load = 0;
+} +}
+ +
+static u32 count_child_tasks(struct task_struct *p) { +static u32 count_child_tasks(struct task_struct *p) {
@ -206,7 +198,7 @@ index 9116bcc90..43e4311db 100644
+} +}
+ +
+static void sched_post_fork_bore(struct task_struct *p) { +static void sched_post_fork_bore(struct task_struct *p) {
+ if (p->sched_class == &fair_sched_class && likely(sched_bore)) + if (p->sched_class == &fair_sched_class)
+ inherit_burst(p); + inherit_burst(p);
+ p->se.burst_penalty = p->se.prev_burst_penalty; + p->se.burst_penalty = p->se.prev_burst_penalty;
+} +}
@ -215,7 +207,7 @@ index 9116bcc90..43e4311db 100644
/* /*
* Perform scheduler related setup for a newly forked process p. * Perform scheduler related setup for a newly forked process p.
* p is forked by current. * p is forked by current.
@@ -4523,6 +4660,9 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p) @@ -4523,6 +4656,9 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p)
p->se.prev_sum_exec_runtime = 0; p->se.prev_sum_exec_runtime = 0;
p->se.nr_migrations = 0; p->se.nr_migrations = 0;
p->se.vruntime = 0; p->se.vruntime = 0;
@ -225,7 +217,7 @@ index 9116bcc90..43e4311db 100644
p->se.vlag = 0; p->se.vlag = 0;
p->se.slice = sysctl_sched_base_slice; p->se.slice = sysctl_sched_base_slice;
INIT_LIST_HEAD(&p->se.group_node); INIT_LIST_HEAD(&p->se.group_node);
@@ -4839,6 +4979,9 @@ void sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs) @@ -4839,6 +4975,9 @@ void sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs)
void sched_post_fork(struct task_struct *p) void sched_post_fork(struct task_struct *p)
{ {
@ -235,20 +227,20 @@ index 9116bcc90..43e4311db 100644
uclamp_post_fork(p); uclamp_post_fork(p);
} }
@@ -9910,6 +10053,11 @@ void __init sched_init(void) @@ -9910,6 +10049,11 @@ void __init sched_init(void)
BUG_ON(&dl_sched_class != &stop_sched_class + 1); BUG_ON(&dl_sched_class != &stop_sched_class + 1);
#endif #endif
+#ifdef CONFIG_SCHED_BORE +#ifdef CONFIG_SCHED_BORE
+ sched_init_bore(); + sched_init_bore();
+ printk(KERN_INFO "BORE (Burst-Oriented Response Enhancer) CPU Scheduler modification 4.5.2 by Masahito Suzuki"); + printk(KERN_INFO "BORE (Burst-Oriented Response Enhancer) CPU Scheduler modification 5.0.3 by Masahito Suzuki");
+#endif // CONFIG_SCHED_BORE +#endif // CONFIG_SCHED_BORE
+ +
wait_bit_init(); wait_bit_init();
#ifdef CONFIG_FAIR_GROUP_SCHED #ifdef CONFIG_FAIR_GROUP_SCHED
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 8d5d98a58..a565363fd 100644 index 8d5d98a58..b17861261 100644
--- a/kernel/sched/debug.c --- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c +++ b/kernel/sched/debug.c
@@ -167,7 +167,52 @@ static const struct file_operations sched_feat_fops = { @@ -167,7 +167,52 @@ static const struct file_operations sched_feat_fops = {
@ -344,19 +336,18 @@ index 8d5d98a58..a565363fd 100644
#ifdef CONFIG_NUMA_BALANCING #ifdef CONFIG_NUMA_BALANCING
SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p)); SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p));
#endif #endif
@@ -1068,6 +1123,10 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns, @@ -1068,6 +1123,9 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
P(se.load.weight); P(se.load.weight);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
+#ifdef CONFIG_SCHED_BORE +#ifdef CONFIG_SCHED_BORE
+ P(se.burst_load);
+ P(se.burst_score); + P(se.burst_score);
+#endif // CONFIG_SCHED_BORE +#endif // CONFIG_SCHED_BORE
P(se.avg.load_sum); P(se.avg.load_sum);
P(se.avg.runnable_sum); P(se.avg.runnable_sum);
P(se.avg.util_sum); P(se.avg.util_sum);
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index fc0a9de42..3ee4e7e70 100644 index fc0a9de42..ae55f46a8 100644
--- a/kernel/sched/fair.c --- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c +++ b/kernel/sched/fair.c
@@ -19,6 +19,9 @@ @@ -19,6 +19,9 @@
@ -369,7 +360,7 @@ index fc0a9de42..3ee4e7e70 100644
*/ */
#include <linux/energy_model.h> #include <linux/energy_model.h>
#include <linux/mmap_lock.h> #include <linux/mmap_lock.h>
@@ -64,28 +67,128 @@ @@ -64,28 +67,125 @@
* SCHED_TUNABLESCALING_LOG - scaled logarithmical, *1+ilog(ncpus) * SCHED_TUNABLESCALING_LOG - scaled logarithmical, *1+ilog(ncpus)
* SCHED_TUNABLESCALING_LINEAR - scaled linear, *ncpus * SCHED_TUNABLESCALING_LINEAR - scaled linear, *ncpus
* *
@ -412,14 +403,12 @@ index fc0a9de42..3ee4e7e70 100644
+ +
+#ifdef CONFIG_SCHED_BORE +#ifdef CONFIG_SCHED_BORE
+u8 __read_mostly sched_bore = 1; +u8 __read_mostly sched_bore = 1;
+u8 __read_mostly sched_burst_score_rounding = 0;
+u8 __read_mostly sched_burst_smoothness_long = 1; +u8 __read_mostly sched_burst_smoothness_long = 1;
+u8 __read_mostly sched_burst_smoothness_short = 0; +u8 __read_mostly sched_burst_smoothness_short = 0;
+u8 __read_mostly sched_burst_fork_atavistic = 2; +u8 __read_mostly sched_burst_fork_atavistic = 2;
+u8 __read_mostly sched_burst_penalty_offset = 22; +u8 __read_mostly sched_burst_penalty_offset = 22;
+uint __read_mostly sched_burst_penalty_scale = 1280; +uint __read_mostly sched_burst_penalty_scale = 1280;
+uint __read_mostly sched_burst_cache_lifetime = 60000000; +uint __read_mostly sched_burst_cache_lifetime = 60000000;
+u8 __read_mostly sched_vlag_deviation_limit = 11;
+static int __maybe_unused thirty_two = 32; +static int __maybe_unused thirty_two = 32;
+static int __maybe_unused sixty_four = 64; +static int __maybe_unused sixty_four = 64;
+static int __maybe_unused maxval_12_bits = 4095; +static int __maybe_unused maxval_12_bits = 4095;
@ -456,20 +445,19 @@ index fc0a9de42..3ee4e7e70 100644
+ return __unscale_slice(delta, se->burst_score); + return __unscale_slice(delta, se->burst_score);
+} +}
+ +
+static void avg_vruntime_add(struct cfs_rq *cfs_rq, struct sched_entity *se); +void reweight_task(struct task_struct *p, int prio);
+static void avg_vruntime_sub(struct cfs_rq *cfs_rq, struct sched_entity *se);
+ +
+static void update_burst_score(struct sched_entity *se) { +static void update_burst_score(struct sched_entity *se) {
+ struct cfs_rq *cfs_rq = cfs_rq_of(se); + if (!entity_is_task(se)) return;
+ u8 prev_score = se->burst_score; + struct task_struct *p = task_of(se);
+ u32 penalty = se->burst_penalty; + u8 prio = p->static_prio - MAX_RT_PRIO;
+ if (sched_burst_score_rounding) penalty += 0x2U; + u8 prev_prio = min(39, prio + se->burst_score);
+ se->burst_score = penalty >> 2;
+ +
+ if ((se->burst_score != prev_score) && se->on_cfs_rq) { + se->burst_score = se->burst_penalty >> 2;
+ avg_vruntime_sub(cfs_rq, se); +
+ avg_vruntime_add(cfs_rq, se); + u8 new_prio = min(39, prio + se->burst_score);
+ } + if (new_prio != prev_prio)
+ reweight_task(p, new_prio);
+} +}
+ +
+static void update_burst_penalty(struct sched_entity *se) { +static void update_burst_penalty(struct sched_entity *se) {
@ -509,7 +497,7 @@ index fc0a9de42..3ee4e7e70 100644
int sched_thermal_decay_shift; int sched_thermal_decay_shift;
static int __init setup_sched_thermal_decay_shift(char *str) static int __init setup_sched_thermal_decay_shift(char *str)
@@ -136,12 +239,8 @@ int __weak arch_asym_cpu_priority(int cpu) @@ -136,12 +236,8 @@ int __weak arch_asym_cpu_priority(int cpu)
* *
* (default: 5 msec, units: microseconds) * (default: 5 msec, units: microseconds)
*/ */
@ -522,7 +510,7 @@ index fc0a9de42..3ee4e7e70 100644
#ifdef CONFIG_NUMA_BALANCING #ifdef CONFIG_NUMA_BALANCING
/* Restrict the NUMA promotion throughput (MB/s) for each target node. */ /* Restrict the NUMA promotion throughput (MB/s) for each target node. */
@@ -150,6 +249,87 @@ static unsigned int sysctl_numa_balancing_promote_rate_limit = 65536; @@ -150,6 +246,69 @@ static unsigned int sysctl_numa_balancing_promote_rate_limit = 65536;
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
static struct ctl_table sched_fair_sysctls[] = { static struct ctl_table sched_fair_sysctls[] = {
@ -533,16 +521,7 @@ index fc0a9de42..3ee4e7e70 100644
+ .maxlen = sizeof(u8), + .maxlen = sizeof(u8),
+ .mode = 0644, + .mode = 0644,
+ .proc_handler = proc_dou8vec_minmax, + .proc_handler = proc_dou8vec_minmax,
+ .extra1 = SYSCTL_ZERO, + .extra1 = SYSCTL_ONE,
+ .extra2 = SYSCTL_ONE,
+ },
+ {
+ .procname = "sched_burst_score_rounding",
+ .data = &sched_burst_score_rounding,
+ .maxlen = sizeof(u8),
+ .mode = 0644,
+ .proc_handler = proc_dou8vec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_ONE, + .extra2 = SYSCTL_ONE,
+ }, + },
+ { + {
@ -597,20 +576,11 @@ index fc0a9de42..3ee4e7e70 100644
+ .mode = 0644, + .mode = 0644,
+ .proc_handler = proc_douintvec, + .proc_handler = proc_douintvec,
+ }, + },
+ {
+ .procname = "sched_vlag_deviation_limit",
+ .data = &sched_vlag_deviation_limit,
+ .maxlen = sizeof(u8),
+ .mode = 0644,
+ .proc_handler = proc_dou8vec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = &thirty_two,
+ },
+#endif // CONFIG_SCHED_BORE +#endif // CONFIG_SCHED_BORE
#ifdef CONFIG_CFS_BANDWIDTH #ifdef CONFIG_CFS_BANDWIDTH
{ {
.procname = "sched_cfs_bandwidth_slice_us", .procname = "sched_cfs_bandwidth_slice_us",
@@ -208,6 +388,13 @@ static inline void update_load_set(struct load_weight *lw, unsigned long w) @@ -208,6 +367,13 @@ static inline void update_load_set(struct load_weight *lw, unsigned long w)
* *
* This idea comes from the SD scheduler of Con Kolivas: * This idea comes from the SD scheduler of Con Kolivas:
*/ */
@ -624,7 +594,7 @@ index fc0a9de42..3ee4e7e70 100644
static unsigned int get_update_sysctl_factor(void) static unsigned int get_update_sysctl_factor(void)
{ {
unsigned int cpus = min_t(unsigned int, num_online_cpus(), 8); unsigned int cpus = min_t(unsigned int, num_online_cpus(), 8);
@@ -238,6 +425,7 @@ static void update_sysctl(void) @@ -238,6 +404,7 @@ static void update_sysctl(void)
SET_SYSCTL(sched_base_slice); SET_SYSCTL(sched_base_slice);
#undef SET_SYSCTL #undef SET_SYSCTL
} }
@ -632,130 +602,17 @@ index fc0a9de42..3ee4e7e70 100644
void __init sched_init_granularity(void) void __init sched_init_granularity(void)
{ {
@@ -311,6 +499,9 @@ static inline u64 calc_delta_fair(u64 delta, struct sched_entity *se) @@ -717,6 +884,9 @@ static void update_entity_lag(struct cfs_rq *cfs_rq, struct sched_entity *se)
if (unlikely(se->load.weight != NICE_0_LOAD))
delta = __calc_delta(delta, NICE_0_LOAD, &se->load);
+#ifdef CONFIG_SCHED_BORE
+ if (likely(sched_bore)) delta = scale_slice(delta, se);
+#endif // CONFIG_SCHED_BORE
return delta;
}
@@ -637,10 +828,26 @@ static inline s64 entity_key(struct cfs_rq *cfs_rq, struct sched_entity *se)
*
* As measured, the max (key * weight) value was ~44 bits for a kernel build.
*/
+#if !defined(CONFIG_SCHED_BORE)
+#define entity_weight(se) scale_load_down(se->load.weight)
+#else // CONFIG_SCHED_BORE
+static unsigned long entity_weight(struct sched_entity *se) {
+ unsigned long weight = se->load.weight;
+ if (likely(sched_bore)) weight = unscale_slice(weight, se);
+#ifdef CONFIG_64BIT
+ weight >>= SCHED_FIXEDPOINT_SHIFT - 3;
+#endif // CONFIG_64BIT
+ return weight;
+}
+#endif // CONFIG_SCHED_BORE
+
static void
avg_vruntime_add(struct cfs_rq *cfs_rq, struct sched_entity *se)
{
- unsigned long weight = scale_load_down(se->load.weight);
+ unsigned long weight = entity_weight(se);
+#ifdef CONFIG_SCHED_BORE
+ se->burst_load = weight;
+#endif // CONFIG_SCHED_BORE
s64 key = entity_key(cfs_rq, se);
cfs_rq->avg_vruntime += key * weight;
@@ -650,7 +857,12 @@ avg_vruntime_add(struct cfs_rq *cfs_rq, struct sched_entity *se)
static void
avg_vruntime_sub(struct cfs_rq *cfs_rq, struct sched_entity *se)
{
- unsigned long weight = scale_load_down(se->load.weight);
+#if !defined(CONFIG_SCHED_BORE)
+ unsigned long weight = entity_weight(se);
+#else // CONFIG_SCHED_BORE
+ unsigned long weight = se->burst_load;
+ se->burst_load = 0;
+#endif // CONFIG_SCHED_BORE
s64 key = entity_key(cfs_rq, se);
cfs_rq->avg_vruntime -= key * weight;
@@ -670,14 +882,14 @@ void avg_vruntime_update(struct cfs_rq *cfs_rq, s64 delta)
* Specifically: avg_runtime() + 0 must result in entity_eligible() := true
* For this to be so, the result of this function must have a left bias.
*/
-u64 avg_vruntime(struct cfs_rq *cfs_rq)
+static u64 avg_key(struct cfs_rq *cfs_rq)
{
struct sched_entity *curr = cfs_rq->curr;
s64 avg = cfs_rq->avg_vruntime;
long load = cfs_rq->avg_load;
if (curr && curr->on_rq) {
- unsigned long weight = scale_load_down(curr->load.weight);
+ unsigned long weight = entity_weight(curr);
avg += entity_key(cfs_rq, curr) * weight;
load += weight;
@@ -687,12 +899,15 @@ u64 avg_vruntime(struct cfs_rq *cfs_rq)
/* sign flips effective floor / ceil */
if (avg < 0)
avg -= (load - 1);
- avg = div_s64(avg, load);
+ avg = div64_s64(avg, load);
}
- return cfs_rq->min_vruntime + avg;
+ return avg;
}
+u64 avg_vruntime(struct cfs_rq *cfs_rq) {
+ return cfs_rq->min_vruntime + avg_key(cfs_rq);
+}
/*
* lag_i = S - s_i = w_i * (V - v_i)
*
@@ -717,6 +932,9 @@ static void update_entity_lag(struct cfs_rq *cfs_rq, struct sched_entity *se)
lag = avg_vruntime(cfs_rq) - se->vruntime; lag = avg_vruntime(cfs_rq) - se->vruntime;
limit = calc_delta_fair(max_t(u64, 2*se->slice, TICK_NSEC), se); limit = calc_delta_fair(max_t(u64, 2*se->slice, TICK_NSEC), se);
+#ifdef CONFIG_SCHED_BORE +#ifdef CONFIG_SCHED_BORE
+ if (likely(sched_bore)) limit >>= 1; + limit >>= 1;
+#endif // CONFIG_SCHED_BORE +#endif // CONFIG_SCHED_BORE
se->vlag = clamp(lag, -limit, limit); se->vlag = clamp(lag, -limit, limit);
} }
@@ -744,7 +962,7 @@ static int vruntime_eligible(struct cfs_rq *cfs_rq, u64 vruntime) @@ -968,6 +1138,7 @@ struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
long load = cfs_rq->avg_load;
if (curr && curr->on_rq) {
- unsigned long weight = scale_load_down(curr->load.weight);
+ unsigned long weight = entity_weight(curr);
avg += entity_key(cfs_rq, curr) * weight;
load += weight;
@@ -840,10 +1058,16 @@ static void __enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
se->min_vruntime = se->vruntime;
rb_add_augmented_cached(&se->run_node, &cfs_rq->tasks_timeline,
__entity_less, &min_vruntime_cb);
+#ifdef CONFIG_SCHED_BORE
+ se->on_cfs_rq = true;
+#endif // CONFIG_SCHED_BORE
}
static void __dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
{
+#ifdef CONFIG_SCHED_BORE
+ se->on_cfs_rq = false;
+#endif // CONFIG_SCHED_BORE
rb_erase_augmented_cached(&se->run_node, &cfs_rq->tasks_timeline,
&min_vruntime_cb);
avg_vruntime_sub(cfs_rq, se);
@@ -968,6 +1192,7 @@ struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
* Scheduling class statistics methods: * Scheduling class statistics methods:
*/ */
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
@ -763,7 +620,7 @@ index fc0a9de42..3ee4e7e70 100644
int sched_update_scaling(void) int sched_update_scaling(void)
{ {
unsigned int factor = get_update_sysctl_factor(); unsigned int factor = get_update_sysctl_factor();
@@ -979,6 +1204,7 @@ int sched_update_scaling(void) @@ -979,6 +1150,7 @@ int sched_update_scaling(void)
return 0; return 0;
} }
@ -771,7 +628,7 @@ index fc0a9de42..3ee4e7e70 100644
#endif #endif
#endif #endif
@@ -1178,7 +1404,13 @@ static void update_curr(struct cfs_rq *cfs_rq) @@ -1178,7 +1350,13 @@ static void update_curr(struct cfs_rq *cfs_rq)
if (unlikely(delta_exec <= 0)) if (unlikely(delta_exec <= 0))
return; return;
@ -785,54 +642,17 @@ index fc0a9de42..3ee4e7e70 100644
update_deadline(cfs_rq, curr); update_deadline(cfs_rq, curr);
update_min_vruntime(cfs_rq); update_min_vruntime(cfs_rq);
@@ -5170,8 +5402,8 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq) {} @@ -5184,6 +5362,9 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
static void
place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
{
- u64 vslice, vruntime = avg_vruntime(cfs_rq);
- s64 lag = 0;
+ s64 lag = 0, key = avg_key(cfs_rq);
+ u64 vslice, vruntime = cfs_rq->min_vruntime + key;
se->slice = sysctl_sched_base_slice;
vslice = calc_delta_fair(se->slice, se);
@@ -5184,6 +5416,9 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
* *
* EEVDF: placement strategy #1 / #2 * EEVDF: placement strategy #1 / #2
*/ */
+#ifdef CONFIG_SCHED_BORE +#ifdef CONFIG_SCHED_BORE
+ if (unlikely(!sched_bore) || se->vlag) + if (se->vlag)
+#endif // CONFIG_SCHED_BORE +#endif // CONFIG_SCHED_BORE
if (sched_feat(PLACE_LAG) && cfs_rq->nr_running) { if (sched_feat(PLACE_LAG) && cfs_rq->nr_running) {
struct sched_entity *curr = cfs_rq->curr; struct sched_entity *curr = cfs_rq->curr;
unsigned long load; unsigned long load;
@@ -5244,12 +5479,22 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) @@ -6816,6 +6997,14 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)
*/
load = cfs_rq->avg_load;
if (curr && curr->on_rq)
- load += scale_load_down(curr->load.weight);
+ load += entity_weight(curr);
- lag *= load + scale_load_down(se->load.weight);
+ lag *= load + entity_weight(se);
+#if !defined(CONFIG_SCHED_BORE)
if (WARN_ON_ONCE(!load))
+#else // CONFIG_SCHED_BORE
+ if (unlikely(!load))
+#endif // CONFIG_SCHED_BORE
load = 1;
- lag = div_s64(lag, load);
+ lag = div64_s64(lag, load);
+#ifdef CONFIG_SCHED_BORE
+ if (likely(sched_bore)) {
+ s64 limit = vslice << sched_vlag_deviation_limit;
+ lag = clamp(lag, -limit, limit);
+ }
+#endif // CONFIG_SCHED_BORE
}
se->vruntime = vruntime - lag;
@@ -6816,6 +7061,14 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)
bool was_sched_idle = sched_idle_rq(rq); bool was_sched_idle = sched_idle_rq(rq);
util_est_dequeue(&rq->cfs, p); util_est_dequeue(&rq->cfs, p);
@ -847,7 +667,7 @@ index fc0a9de42..3ee4e7e70 100644
for_each_sched_entity(se) { for_each_sched_entity(se) {
cfs_rq = cfs_rq_of(se); cfs_rq = cfs_rq_of(se);
@@ -8565,16 +8818,25 @@ static void yield_task_fair(struct rq *rq) @@ -8565,16 +8754,25 @@ static void yield_task_fair(struct rq *rq)
/* /*
* Are we the only task in the tree? * Are we the only task in the tree?
*/ */
@ -873,7 +693,7 @@ index fc0a9de42..3ee4e7e70 100644
/* /*
* Tell update_rq_clock() that we've just updated, * Tell update_rq_clock() that we've just updated,
* so we don't do microscopic update in schedule() * so we don't do microscopic update in schedule()
@@ -12664,6 +12926,9 @@ static void task_fork_fair(struct task_struct *p) @@ -12664,6 +12862,9 @@ static void task_fork_fair(struct task_struct *p)
curr = cfs_rq->curr; curr = cfs_rq->curr;
if (curr) if (curr)
update_curr(cfs_rq); update_curr(cfs_rq);

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,6 @@
cachyos/0001-cachyos-base-all.patch cachyos/0001-cachyos-base-all.patch
cachyos/0001-bore-cachy.patch cachyos/0001-bore-cachy.patch
cachyos/0002-ntsync.patch cachyos/0002-ntsync.patch
cachyos/0003-nvidia.patch
cachyos/0004-intel.patch cachyos/0004-intel.patch
nobara/0001-Allow-to-set-custom-USB-pollrate-for-specific-device.patch nobara/0001-Allow-to-set-custom-USB-pollrate-for-specific-device.patch
nobara/0001-Revert-PCI-Add-a-REBAR-size-quirk-for-Sapphire-RX-56.patch nobara/0001-Revert-PCI-Add-a-REBAR-size-quirk-for-Sapphire-RX-56.patch
@ -9,7 +8,6 @@ nobara/0001-Revert-nvme-pci-drop-redundant-pci_enable_pcie_error.patch
nobara/0001-Set-amdgpu.ppfeaturemask-0xffffffff-as-default.patch nobara/0001-Set-amdgpu.ppfeaturemask-0xffffffff-as-default.patch
nobara/0001-acpi-proc-idle-skip-dummy-wait.patch nobara/0001-acpi-proc-idle-skip-dummy-wait.patch
nobara/0001-add-acpi_call.patch nobara/0001-add-acpi_call.patch
nobara/OpenRGB.patch
nobara/amdgpu-si-cik-default.patch nobara/amdgpu-si-cik-default.patch
asuslinux/0001-platform-x86-asus-wmi-add-support-for-2024-ROG-Mini-.patch asuslinux/0001-platform-x86-asus-wmi-add-support-for-2024-ROG-Mini-.patch
asuslinux/0002-platform-x86-asus-wmi-add-support-for-Vivobook-GPU-M.patch asuslinux/0002-platform-x86-asus-wmi-add-support-for-Vivobook-GPU-M.patch

View File

@ -4,11 +4,12 @@ echo "Pika Kernel - Applying configuration"
cp ../config .config cp ../config .config
scripts/config -k -e CONFIG_GENERIC_CPU scripts/config -k -d CONFIG_GENERIC_CPU
scripts/config -k -e CONFIG_GENERIC_CPU2
scripts/config -e CACHY scripts/config -e CACHY
scripts/config -e SCHED_BORE scripts/config -e SCHED_BORE
scripts/config -e HZ_300 --set-val HZ 500 scripts/config -e HZ_300 --set-val HZ 750
scripts/config -d HZ_PERIODIC -d NO_HZ_IDLE -d CONTEXT_TRACKING_FORCE -e NO_HZ_FULL_NODEF -e NO_HZ_FULL -e NO_HZ -e NO_HZ_COMMON -e CONTEXT_TRACKING scripts/config -d HZ_PERIODIC -d NO_HZ_IDLE -d CONTEXT_TRACKING_FORCE -e NO_HZ_FULL_NODEF -e NO_HZ_FULL -e NO_HZ -e NO_HZ_COMMON -e CONTEXT_TRACKING
scripts/config -e PREEMPT_BUILD -d PREEMPT_NONE -d PREEMPT_VOLUNTARY -e PREEMPT -e PREEMPT_COUNT -e PREEMPTION -e PREEMPT_DYNAMIC scripts/config -e PREEMPT_BUILD -d PREEMPT_NONE -d PREEMPT_VOLUNTARY -e PREEMPT -e PREEMPT_COUNT -e PREEMPTION -e PREEMPT_DYNAMIC