Mantic and 6.5.5

This commit is contained in:
ferrreo 2023-09-28 18:31:36 +01:00
parent 761475e029
commit 0a58162bad
9 changed files with 4831 additions and 100273 deletions

26
config
View File

@ -127,9 +127,7 @@ CONFIG_BPF_JIT=y
CONFIG_BPF_JIT_ALWAYS_ON=y
CONFIG_BPF_JIT_DEFAULT_ON=y
CONFIG_BPF_UNPRIV_DEFAULT_OFF=y
CONFIG_USERMODE_DRIVER=y
CONFIG_BPF_PRELOAD=y
CONFIG_BPF_PRELOAD_UMD=m
# CONFIG_BPF_PRELOAD is not set
CONFIG_BPF_LSM=y
# end of BPF subsystem
@ -187,7 +185,7 @@ CONFIG_RCU_NOCB_CPU_DEFAULT_ALL=y
# CONFIG_RCU_NOCB_CPU_CB_BOOST is not set
# CONFIG_TASKS_TRACE_RCU_READ_MB is not set
CONFIG_RCU_LAZY=y
# CONFIG_RCU_DOUBLE_CHECK_CB_TIME is not set
CONFIG_RCU_DOUBLE_CHECK_CB_TIME=y
# end of RCU Subsystem
CONFIG_IKCONFIG=y
@ -1116,7 +1114,7 @@ CONFIG_ZPOOL=y
CONFIG_SWAP=y
CONFIG_ZSWAP=y
CONFIG_ZSWAP_DEFAULT_ON=y
CONFIG_ZSWAP_EXCLUSIVE_LOADS_DEFAULT_ON=y
# CONFIG_ZSWAP_EXCLUSIVE_LOADS_DEFAULT_ON is not set
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_DEFLATE is not set
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZO is not set
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_842 is not set
@ -2328,7 +2326,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
# Firmware loader
#
CONFIG_FW_LOADER=y
# CONFIG_FW_LOADER_DEBUG is not set
CONFIG_FW_LOADER_DEBUG=y
CONFIG_FW_LOADER_PAGED_BUF=y
CONFIG_FW_LOADER_SYSFS=y
CONFIG_EXTRA_FIRMWARE=""
@ -6199,6 +6197,7 @@ CONFIG_DVB_BUDGET_CORE=m
CONFIG_DVB_BUDGET=m
CONFIG_DVB_BUDGET_CI=m
CONFIG_DVB_BUDGET_AV=m
CONFIG_IPU_BRIDGE=m
CONFIG_VIDEO_IPU3_CIO2=m
CONFIG_CIO2_BRIDGE=y
CONFIG_RADIO_ADAPTERS=m
@ -6383,10 +6382,7 @@ CONFIG_MEDIA_ATTACH=y
# IR I2C driver auto-selected by 'Autoselect ancillary drivers'
#
CONFIG_VIDEO_IR_I2C=m
#
# Camera sensor devices
#
CONFIG_VIDEO_CAMERA_SENSOR=y
CONFIG_VIDEO_APTINA_PLL=m
CONFIG_VIDEO_CCS_PLL=m
CONFIG_VIDEO_AR0521=m
@ -6449,7 +6445,6 @@ CONFIG_VIDEO_S5K5BAF=m
CONFIG_VIDEO_S5K6A3=m
CONFIG_VIDEO_CCS=m
CONFIG_VIDEO_ET8EK8=m
# end of Camera sensor devices
#
# Lens drivers
@ -7036,6 +7031,8 @@ CONFIG_SND_DMAENGINE_PCM=m
CONFIG_SND_HWDEP=m
CONFIG_SND_SEQ_DEVICE=m
CONFIG_SND_RAWMIDI=m
CONFIG_SND_UMP=m
# CONFIG_SND_UMP_LEGACY_RAWMIDI is not set
CONFIG_SND_COMPRESS_OFFLOAD=m
CONFIG_SND_JACK=y
CONFIG_SND_JACK_INPUT_DEV=y
@ -7070,6 +7067,7 @@ CONFIG_SND_SEQ_MIDI=m
CONFIG_SND_SEQ_MIDI_EMUL=m
CONFIG_SND_SEQ_VIRMIDI=m
CONFIG_SND_SEQ_UMP=y
CONFIG_SND_SEQ_UMP_CLIENT=m
CONFIG_SND_MPU401_UART=m
CONFIG_SND_OPL3_LIB=m
CONFIG_SND_OPL3_LIB_SEQ=m
@ -7210,7 +7208,7 @@ CONFIG_SND_INTEL_SOUNDWIRE_ACPI=m
CONFIG_SND_SPI=y
CONFIG_SND_USB=y
CONFIG_SND_USB_AUDIO=m
# CONFIG_SND_USB_AUDIO_MIDI_V2 is not set
CONFIG_SND_USB_AUDIO_MIDI_V2=y
CONFIG_SND_USB_AUDIO_USE_MEDIA_CONTROLLER=y
CONFIG_SND_USB_UA101=m
CONFIG_SND_USB_USX2Y=m
@ -10515,7 +10513,7 @@ CONFIG_PNFS_FILE_LAYOUT=m
CONFIG_PNFS_BLOCK=m
CONFIG_PNFS_FLEXFILE_LAYOUT=m
CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org"
CONFIG_NFS_V4_1_MIGRATION=y
# CONFIG_NFS_V4_1_MIGRATION is not set
CONFIG_NFS_V4_SECURITY_LABEL=y
CONFIG_NFS_FSCACHE=y
# CONFIG_NFS_USE_LEGACY_DNS is not set
@ -11465,7 +11463,7 @@ CONFIG_FTRACE=y
CONFIG_BOOTTIME_TRACING=y
CONFIG_FUNCTION_TRACER=y
CONFIG_FUNCTION_GRAPH_TRACER=y
# CONFIG_FUNCTION_GRAPH_RETVAL is not set
CONFIG_FUNCTION_GRAPH_RETVAL=y
CONFIG_DYNAMIC_FTRACE=y
CONFIG_DYNAMIC_FTRACE_WITH_REGS=y
CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=y

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
From 9a3788351b1bc830a28d7a51740d2ee964ab8319 Mon Sep 17 00:00:00 2001
From 410781f5dc233cd65c650a63eb9470aaa45daa7d Mon Sep 17 00:00:00 2001
From: Peter Jung <admin@ptr1337.dev>
Date: Mon, 28 Aug 2023 14:04:00 +0200
Subject: [PATCH] EEVDF
Date: Tue, 19 Sep 2023 14:32:19 +0200
Subject: [PATCH] EEVDF-cachy
Signed-off-by: Peter Jung <admin@ptr1337.dev>
---
@ -476,7 +476,7 @@ index 066ff1c8ae4e..e7e83181fbb6 100644
P(dl.runtime);
P(dl.deadline);
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 2c335df30171..e0a4c13dab04 100644
index ff3386691626..d49c0f979232 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -47,6 +47,7 @@
@ -1709,7 +1709,7 @@ index 2c335df30171..e0a4c13dab04 100644
#ifdef CONFIG_SMP
static int sched_idle_cpu(int cpu)
{
@@ -7816,18 +7870,6 @@ static void migrate_task_rq_fair(struct task_struct *p, int new_cpu)
@@ -7813,18 +7867,6 @@ static void migrate_task_rq_fair(struct task_struct *p, int new_cpu)
{
struct sched_entity *se = &p->se;
@ -1728,7 +1728,7 @@ index 2c335df30171..e0a4c13dab04 100644
if (!task_on_rq_migrating(p)) {
remove_entity_load_avg(se);
@@ -7865,66 +7907,6 @@ balance_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
@@ -7862,66 +7904,6 @@ balance_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
}
#endif /* CONFIG_SMP */
@ -1795,7 +1795,7 @@ index 2c335df30171..e0a4c13dab04 100644
static void set_next_buddy(struct sched_entity *se)
{
for_each_sched_entity(se) {
@@ -7936,12 +7918,6 @@ static void set_next_buddy(struct sched_entity *se)
@@ -7933,12 +7915,6 @@ static void set_next_buddy(struct sched_entity *se)
}
}
@ -1808,7 +1808,7 @@ index 2c335df30171..e0a4c13dab04 100644
/*
* Preempt the current task with a newly woken task if needed:
*/
@@ -7950,7 +7926,6 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
@@ -7947,7 +7923,6 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
struct task_struct *curr = rq->curr;
struct sched_entity *se = &curr->se, *pse = &p->se;
struct cfs_rq *cfs_rq = task_cfs_rq(curr);
@ -1816,7 +1816,7 @@ index 2c335df30171..e0a4c13dab04 100644
int next_buddy_marked = 0;
int cse_is_idle, pse_is_idle;
@@ -7966,7 +7941,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
@@ -7963,7 +7938,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
if (unlikely(throttled_hierarchy(cfs_rq_of(pse))))
return;
@ -1825,7 +1825,7 @@ index 2c335df30171..e0a4c13dab04 100644
set_next_buddy(pse);
next_buddy_marked = 1;
}
@@ -8011,35 +7986,19 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
@@ -8008,35 +7983,19 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
if (cse_is_idle != pse_is_idle)
return;
@ -1868,7 +1868,7 @@ index 2c335df30171..e0a4c13dab04 100644
}
#ifdef CONFIG_SMP
@@ -8240,8 +8199,6 @@ static void put_prev_task_fair(struct rq *rq, struct task_struct *prev)
@@ -8237,8 +8196,6 @@ static void put_prev_task_fair(struct rq *rq, struct task_struct *prev)
/*
* sched_yield() is very simple
@ -1877,7 +1877,7 @@ index 2c335df30171..e0a4c13dab04 100644
*/
static void yield_task_fair(struct rq *rq)
{
@@ -8257,21 +8214,19 @@ static void yield_task_fair(struct rq *rq)
@@ -8254,21 +8211,19 @@ static void yield_task_fair(struct rq *rq)
clear_buddies(cfs_rq, se);
@ -1911,7 +1911,7 @@ index 2c335df30171..e0a4c13dab04 100644
}
static bool yield_to_task_fair(struct rq *rq, struct task_struct *p)
@@ -8514,8 +8469,7 @@ static int task_hot(struct task_struct *p, struct lb_env *env)
@@ -8511,8 +8466,7 @@ static int task_hot(struct task_struct *p, struct lb_env *env)
* Buddy candidates are cache hot:
*/
if (sched_feat(CACHE_HOT_BUDDY) && env->dst_rq->nr_running &&
@ -1921,7 +1921,7 @@ index 2c335df30171..e0a4c13dab04 100644
return 1;
if (sysctl_sched_migration_cost == -1)
@@ -12025,8 +11979,8 @@ static void rq_offline_fair(struct rq *rq)
@@ -12022,8 +11976,8 @@ static void rq_offline_fair(struct rq *rq)
static inline bool
__entity_slice_used(struct sched_entity *se, int min_nr_tasks)
{
@ -1931,7 +1931,7 @@ index 2c335df30171..e0a4c13dab04 100644
return (rtime * min_nr_tasks > slice);
}
@@ -12182,8 +12136,8 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued)
@@ -12179,8 +12133,8 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued)
*/
static void task_fork_fair(struct task_struct *p)
{
@ -1941,7 +1941,7 @@ index 2c335df30171..e0a4c13dab04 100644
struct rq *rq = this_rq();
struct rq_flags rf;
@@ -12192,22 +12146,9 @@ static void task_fork_fair(struct task_struct *p)
@@ -12189,22 +12143,9 @@ static void task_fork_fair(struct task_struct *p)
cfs_rq = task_cfs_rq(current);
curr = cfs_rq->curr;
@ -1966,7 +1966,7 @@ index 2c335df30171..e0a4c13dab04 100644
rq_unlock(rq, &rf);
}
@@ -12236,34 +12177,6 @@ prio_changed_fair(struct rq *rq, struct task_struct *p, int oldprio)
@@ -12233,34 +12174,6 @@ prio_changed_fair(struct rq *rq, struct task_struct *p, int oldprio)
check_preempt_curr(rq, p, 0);
}
@ -2001,7 +2001,7 @@ index 2c335df30171..e0a4c13dab04 100644
#ifdef CONFIG_FAIR_GROUP_SCHED
/*
* Propagate the changes of the sched_entity across the tg tree to make it
@@ -12334,16 +12247,6 @@ static void attach_entity_cfs_rq(struct sched_entity *se)
@@ -12331,16 +12244,6 @@ static void attach_entity_cfs_rq(struct sched_entity *se)
static void detach_task_cfs_rq(struct task_struct *p)
{
struct sched_entity *se = &p->se;
@ -2018,7 +2018,7 @@ index 2c335df30171..e0a4c13dab04 100644
detach_entity_cfs_rq(se);
}
@@ -12351,12 +12254,8 @@ static void detach_task_cfs_rq(struct task_struct *p)
@@ -12348,12 +12251,8 @@ static void detach_task_cfs_rq(struct task_struct *p)
static void attach_task_cfs_rq(struct task_struct *p)
{
struct sched_entity *se = &p->se;
@ -2031,7 +2031,7 @@ index 2c335df30171..e0a4c13dab04 100644
}
static void switched_from_fair(struct rq *rq, struct task_struct *p)
@@ -12467,6 +12366,7 @@ int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
@@ -12464,6 +12363,7 @@ int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
goto err;
tg->shares = NICE_0_LOAD;
@ -2039,7 +2039,7 @@ index 2c335df30171..e0a4c13dab04 100644
init_cfs_bandwidth(tg_cfs_bandwidth(tg));
@@ -12565,6 +12465,9 @@ void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq,
@@ -12562,6 +12462,9 @@ void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq,
}
se->my_q = cfs_rq;
@ -2049,7 +2049,7 @@ index 2c335df30171..e0a4c13dab04 100644
/* guarantee group entities always have weight */
update_load_set(&se->load, NICE_0_LOAD);
se->parent = parent;
@@ -12695,6 +12598,29 @@ int sched_group_set_idle(struct task_group *tg, long idle)
@@ -12692,6 +12595,29 @@ int sched_group_set_idle(struct task_group *tg, long idle)
return 0;
}
@ -2079,7 +2079,7 @@ index 2c335df30171..e0a4c13dab04 100644
#else /* CONFIG_FAIR_GROUP_SCHED */
void free_fair_sched_group(struct task_group *tg) { }
@@ -12721,7 +12647,7 @@ static unsigned int get_rr_interval_fair(struct rq *rq, struct task_struct *task
@@ -12718,7 +12644,7 @@ static unsigned int get_rr_interval_fair(struct rq *rq, struct task_struct *task
* idle runqueue:
*/
if (rq->cfs.load.weight)

View File

@ -1,20 +1,19 @@
From f353b9eb23586e55b99a6bfe7da9563be5fcca29 Mon Sep 17 00:00:00 2001
From c92de794ee60ef526ca33cfee59e96f0d95b0697 Mon Sep 17 00:00:00 2001
From: Piotr Gorski <lucjan.lucjanov@gmail.com>
Date: Sat, 12 Aug 2023 21:05:20 +0200
Date: Sun, 17 Sep 2023 22:51:20 +0200
Subject: [PATCH] bore-eevdf
Signed-off-by: Piotr Gorski <lucjan.lucjanov@gmail.com>
---
include/linux/sched.h | 29 ++++++
init/Kconfig | 20 ++++
kernel/sched/core.c | 122 +++++++++++++++++++++++
kernel/sched/debug.c | 4 +
kernel/sched/fair.c | 219 +++++++++++++++++++++++++++++++++++++++---
kernel/sched/sched.h | 1 +
6 files changed, 384 insertions(+), 11 deletions(-)
include/linux/sched.h | 31 ++++++++
init/Kconfig | 20 +++++
kernel/sched/core.c | 160 +++++++++++++++++++++++++++++++++++++++
kernel/sched/debug.c | 3 +
kernel/sched/fair.c | 169 +++++++++++++++++++++++++++++++++++++++++-
5 files changed, 381 insertions(+), 2 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c940c4dc8..984931de0 100644
index c940c4dc8..e88251927 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -545,6 +545,24 @@ struct sched_statistics {
@ -55,7 +54,7 @@ index c940c4dc8..984931de0 100644
s64 vlag;
u64 slice;
@@ -990,6 +1014,11 @@ struct task_struct {
@@ -990,6 +1014,13 @@ struct task_struct {
struct list_head children;
struct list_head sibling;
struct task_struct *group_leader;
@ -63,15 +62,17 @@ index c940c4dc8..984931de0 100644
+ u16 child_burst_cache;
+ u16 child_burst_count_cache;
+ u64 child_burst_last_cached;
+ u16 group_burst_cache;
+ u64 group_burst_last_cached;
+#endif // CONFIG_SCHED_BORE
/*
* 'ptraced' is the list of tasks this task is using ptrace() on.
diff --git a/init/Kconfig b/init/Kconfig
index 71755cc8e..c697be79e 100644
index 25193a9d5..acc02af18 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1277,6 +1277,26 @@ config CHECKPOINT_RESTORE
@@ -1278,6 +1278,26 @@ config CHECKPOINT_RESTORE
If unsure, say N here.
@ -99,10 +100,10 @@ index 71755cc8e..c697be79e 100644
bool "Automatic process group scheduling"
select CGROUPS
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index aff81e124..a4eba9e47 100644
index aff81e124..2cc47b723 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4491,6 +4491,117 @@ int wake_up_state(struct task_struct *p, unsigned int state)
@@ -4491,6 +4491,155 @@ int wake_up_state(struct task_struct *p, unsigned int state)
return try_to_wake_up(p, state, 0);
}
@ -115,6 +116,8 @@ index aff81e124..a4eba9e47 100644
+ init_task.child_burst_cache = 0;
+ init_task.child_burst_count_cache = 0;
+ init_task.child_burst_last_cached = 0;
+ init_task.group_burst_cache = 0;
+ init_task.group_burst_last_cached = 0;
+ init_task.se.burst_time = 0;
+ init_task.se.prev_burst_penalty = 0;
+ init_task.se.curr_burst_penalty = 0;
@ -125,6 +128,8 @@ index aff81e124..a4eba9e47 100644
+ p->child_burst_cache = 0;
+ p->child_burst_count_cache = 0;
+ p->child_burst_last_cached = 0;
+ p->group_burst_cache = 0;
+ p->group_burst_last_cached = 0;
+ p->se.burst_time = 0;
+ p->se.curr_burst_penalty = 0;
+}
@ -140,6 +145,10 @@ index aff81e124..a4eba9e47 100644
+ return (p->child_burst_last_cached + sched_burst_cache_lifetime < now);
+}
+
+static inline bool group_burst_cache_expired(struct task_struct *p, u64 now) {
+ return (p->group_burst_last_cached + sched_burst_cache_lifetime < now);
+}
+
+static void __update_child_burst_cache(
+ struct task_struct *p, u32 cnt, u32 sum, u64 now) {
+ u16 avg = 0;
@ -191,36 +200,66 @@ index aff81e124..a4eba9e47 100644
+ *asum += sum;
+}
+
+static void update_group_burst_cache(struct task_struct *p, u64 now) {
+ struct task_struct *member;
+ u32 cnt = 0, sum = 0;
+ u16 avg = 0;
+
+ for_each_thread(p, member) {
+ cnt++;
+ sum += member->se.burst_penalty;
+ }
+
+ if (cnt) avg = DIV_ROUND_CLOSEST(sum, cnt);
+ p->group_burst_cache = max(avg, p->se.burst_penalty);
+ p->group_burst_last_cached = now;
+}
+
+#define forked_task_is_process(p) (p->pid == p->tgid)
+
+static void fork_burst_penalty(struct task_struct *p) {
+ struct sched_entity *se = &p->se;
+ struct task_struct *anc = p->real_parent;
+ struct task_struct *anc;
+ u64 now = ktime_get_ns();
+ u32 cnt = 0;
+ u32 sum = 0;
+ u32 cnt = 0, sum = 0;
+ u16 burst_cache;
+
+ read_lock(&tasklist_lock);
+
+ if (likely(sched_bore) && likely(sched_burst_fork_atavistic)) {
+ while ((anc->real_parent != anc) && (count_child_tasks(anc) == 1))
+ anc = anc->real_parent;
+ if (child_burst_cache_expired(anc, now))
+ update_child_burst_cache_atavistic(
+ anc, now, sched_burst_fork_atavistic - 1, &cnt, &sum);
+ } else
+ if (child_burst_cache_expired(anc, now))
+ update_child_burst_cache(anc, now);
+ if (likely(sched_bore)) {
+ read_lock(&tasklist_lock);
+
+ read_unlock(&tasklist_lock);
+ if (forked_task_is_process(p)) {
+ anc = p->real_parent;
+ if (likely(sched_burst_fork_atavistic)) {
+ while ((anc->real_parent != anc) &&
+ (count_child_tasks(anc) == 1))
+ anc = anc->real_parent;
+ if (child_burst_cache_expired(anc, now))
+ update_child_burst_cache_atavistic(
+ anc, now, sched_burst_fork_atavistic - 1, &cnt, &sum);
+ } else
+ if (child_burst_cache_expired(anc, now))
+ update_child_burst_cache(anc, now);
+
+ se->burst_penalty = se->prev_burst_penalty =
+ max(se->prev_burst_penalty, anc->child_burst_cache);
+ burst_cache = anc->child_burst_cache;
+ } else {
+ anc = p->group_leader;
+ if (group_burst_cache_expired(anc, now))
+ update_group_burst_cache(anc, now);
+
+ burst_cache = anc->group_burst_cache;
+ }
+
+ read_unlock(&tasklist_lock);
+ se->prev_burst_penalty = max(se->prev_burst_penalty, burst_cache);
+ }
+ se->burst_penalty = se->prev_burst_penalty;
+}
+#endif // CONFIG_SCHED_BORE
+
/*
* Perform scheduler related setup for a newly forked process p.
* p is forked by current.
@@ -4507,6 +4618,9 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p)
@@ -4507,6 +4656,9 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p)
p->se.prev_sum_exec_runtime = 0;
p->se.nr_migrations = 0;
p->se.vruntime = 0;
@ -230,7 +269,7 @@ index aff81e124..a4eba9e47 100644
p->se.vlag = 0;
INIT_LIST_HEAD(&p->se.group_node);
@@ -4828,6 +4942,9 @@ void sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs)
@@ -4828,6 +4980,9 @@ void sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs)
void sched_post_fork(struct task_struct *p)
{
@ -240,31 +279,23 @@ index aff81e124..a4eba9e47 100644
uclamp_post_fork(p);
}
@@ -9954,6 +10071,11 @@ void __init sched_init(void)
@@ -9954,6 +10109,11 @@ void __init sched_init(void)
BUG_ON(&dl_sched_class != &stop_sched_class + 1);
#endif
+#ifdef CONFIG_SCHED_BORE
+ sched_init_bore();
+ printk(KERN_INFO "BORE (Burst-Oriented Response Enhancer) CPU Scheduler modification 3.1.2 by Masahito Suzuki");
+ printk(KERN_INFO "BORE (Burst-Oriented Response Enhancer) CPU Scheduler modification 3.1.4 by Masahito Suzuki");
+#endif // CONFIG_SCHED_BORE
+
wait_bit_init();
#ifdef CONFIG_FAIR_GROUP_SCHED
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index e7e83181f..ff41a524c 100644
index e7e83181f..6ebd52247 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -348,6 +348,7 @@ static __init int sched_init_debug(void)
#endif
debugfs_create_u32("base_slice_ns", 0644, debugfs_sched, &sysctl_sched_base_slice);
+ debugfs_create_u32("wakeup_granularity_ns", 0644, debugfs_sched, &sysctl_sched_wakeup_granularity);
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);
@@ -594,6 +595,9 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
@@ -594,6 +594,9 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
SPLIT_NS(schedstat_val_or_zero(p->stats.sum_sleep_runtime)),
SPLIT_NS(schedstat_val_or_zero(p->stats.sum_block_runtime)));
@ -275,7 +306,7 @@ index e7e83181f..ff41a524c 100644
SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p));
#endif
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 461409c0e..1293fe037 100644
index d49c0f979..dffee0766 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -19,6 +19,9 @@
@ -288,49 +319,13 @@ index 461409c0e..1293fe037 100644
*/
#include <linux/energy_model.h>
#include <linux/mmap_lock.h>
@@ -66,17 +69,17 @@
* SCHED_TUNABLESCALING_LOG - scaled logarithmical, *1+ilog(ncpus)
* SCHED_TUNABLESCALING_LINEAR - scaled linear, *ncpus
*
- * (default SCHED_TUNABLESCALING_LOG = *(1+ilog(ncpus))
+ * (default SCHED_TUNABLESCALING_NONE = *1)
*/
-unsigned int sysctl_sched_tunable_scaling = SCHED_TUNABLESCALING_LOG;
+unsigned int sysctl_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
@@ -86,6 +89,67 @@ unsigned int sysctl_sched_child_runs_first __read_mostly;
/*
* Minimal preemption granularity for CPU-bound tasks:
*
- * (default: 0.75 msec * (1 + ilog(ncpus)), units: nanoseconds)
+ * (default: 3 msec * 1, units: nanoseconds)
*/
-unsigned int sysctl_sched_base_slice = 750000ULL;
-static unsigned int normalized_sysctl_sched_base_slice = 750000ULL;
+unsigned int sysctl_sched_base_slice = 3000000ULL;
+static unsigned int normalized_sysctl_sched_base_slice = 3000000ULL;
/*
* After fork, child runs first. If set to 0 (default) then
@@ -84,8 +87,85 @@ static unsigned int normalized_sysctl_sched_base_slice = 750000ULL;
*/
unsigned int sysctl_sched_child_runs_first __read_mostly;
+/*
+ * SCHED_OTHER wake-up granularity.
+ *
+ * This option delays the preemption effects of decoupled workloads
+ * and reduces their over-scheduling. Synchronous workloads will still
+ * have immediate wakeup/sleep latencies.
+ *
+ * (default: 1.6 msec * 1, units: nanoseconds)
+ */
+unsigned int sysctl_sched_wakeup_granularity = 1600000UL;
+static unsigned int normalized_sysctl_sched_wakeup_granularity = 1600000UL;
+
const_debug unsigned int sysctl_sched_migration_cost = 500000UL;
+#ifdef CONFIG_SCHED_BORE
+unsigned int __read_mostly sched_bore = 1;
+unsigned int __read_mostly sched_bore_extra_flags = 0;
+unsigned int __read_mostly sched_burst_cache_lifetime = 60000000;
+unsigned int __read_mostly sched_burst_penalty_offset = 22;
+unsigned int __read_mostly sched_burst_penalty_scale = 1366;
@ -387,17 +382,12 @@ index 461409c0e..1293fe037 100644
+ se->curr_burst_penalty = 0;
+ se->burst_time = 0;
+}
+
+static inline void vruntime_backstep(s64 *vdiff, struct sched_entity *se) {
+ u64 delta_exec = se->sum_exec_runtime - se->prev_sum_exec_runtime;
+ *vdiff += delta_exec - penalty_scale(delta_exec, se, false);
+}
+#endif // CONFIG_SCHED_BORE
+
int sched_thermal_decay_shift;
static int __init setup_sched_thermal_decay_shift(char *str)
{
@@ -145,6 +225,69 @@ static unsigned int sysctl_numa_balancing_promote_rate_limit = 65536;
@@ -145,6 +209,78 @@ static unsigned int sysctl_numa_balancing_promote_rate_limit = 65536;
#ifdef CONFIG_SYSCTL
static struct ctl_table sched_fair_sysctls[] = {
@ -412,6 +402,15 @@ index 461409c0e..1293fe037 100644
+ .extra2 = SYSCTL_ONE,
+ },
+ {
+ .procname = "sched_bore_extra_flags",
+ .data = &sched_bore_extra_flags,
+ .maxlen = sizeof(unsigned int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_ONE,
+ },
+ {
+ .procname = "sched_burst_cache_lifetime",
+ .data = &sched_burst_cache_lifetime,
+ .maxlen = sizeof(unsigned int),
@ -467,20 +466,14 @@ index 461409c0e..1293fe037 100644
{
.procname = "sched_child_runs_first",
.data = &sysctl_sched_child_runs_first,
@@ -238,6 +381,7 @@ static void update_sysctl(void)
#define SET_SYSCTL(name) \
(sysctl_##name = (factor) * normalized_sysctl_##name)
SET_SYSCTL(sched_base_slice);
+ SET_SYSCTL(sched_wakeup_granularity);
#undef SET_SYSCTL
}
@@ -308,11 +452,20 @@ static u64 __calc_delta(u64 delta_exec, unsigned long weight, struct load_weight
@@ -308,11 +444,22 @@ static u64 __calc_delta(u64 delta_exec, unsigned long weight, struct load_weight
/*
* delta /= w
*/
+#ifdef CONFIG_SCHED_BORE
+#define calc_delta_fair_half(delta, se) __calc_delta_fair(delta, se, true)
+#define bore_start_debit_full_penalty (sched_bore_extra_flags)
+#define calc_delta_fair_debit(delta, se) \
+ __calc_delta_fair(delta, se, !bore_start_debit_full_penalty)
+#define calc_delta_fair(delta, se) __calc_delta_fair(delta, se, false)
+static inline u64 __calc_delta_fair(u64 delta, struct sched_entity *se, bool half)
+#else // CONFIG_SCHED_BORE
@ -496,15 +489,7 @@ index 461409c0e..1293fe037 100644
return delta;
}
@@ -944,6 +1097,7 @@ int sched_update_scaling(void)
#define WRT_SYSCTL(name) \
(normalized_sysctl_##name = sysctl_##name / (factor))
WRT_SYSCTL(sched_base_slice);
+ WRT_SYSCTL(sched_wakeup_granularity);
#undef WRT_SYSCTL
return 0;
@@ -1121,7 +1275,11 @@ static void update_curr(struct cfs_rq *cfs_rq)
@@ -1128,7 +1275,11 @@ static void update_curr(struct cfs_rq *cfs_rq)
curr->sum_exec_runtime += delta_exec;
schedstat_add(cfs_rq->exec_clock, delta_exec);
@ -517,76 +502,19 @@ index 461409c0e..1293fe037 100644
update_deadline(cfs_rq, curr);
update_min_vruntime(cfs_rq);
@@ -4919,7 +5077,7 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq) {}
@@ -4926,7 +5077,11 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq) {}
static void
place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
{
- u64 vslice = calc_delta_fair(se->slice, se);
+ u64 vslice = calc_delta_fair_half(se->slice, se);
+#ifdef CONFIG_SCHED_BORE
+ u64 vslice = calc_delta_fair_debit(se->slice, se);
+#else // CONFIG_SCHED_BORE
u64 vslice = calc_delta_fair(se->slice, se);
+#endif // CONFIG_SCHED_BORE
u64 vruntime = avg_vruntime(cfs_rq);
s64 lag = 0;
@@ -5187,6 +5345,9 @@ set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
se->prev_sum_exec_runtime = se->sum_exec_runtime;
}
+static int
+wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se);
+
/*
* Pick the next process, keeping these things in mind, in this order:
* 1) keep things fair between processes/task groups
@@ -5197,14 +5358,16 @@ set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
static struct sched_entity *
pick_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *curr)
{
+ struct sched_entity *candidate = pick_eevdf(cfs_rq);
/*
* Enabling NEXT_BUDDY will affect latency but not fairness.
*/
if (sched_feat(NEXT_BUDDY) &&
- cfs_rq->next && entity_eligible(cfs_rq, cfs_rq->next))
+ cfs_rq->next && entity_eligible(cfs_rq, cfs_rq->next) &&
+ wakeup_preempt_entity(cfs_rq->next, candidate) < 1)
return cfs_rq->next;
- return pick_eevdf(cfs_rq);
+ return candidate;
}
static bool check_cfs_rq_runtime(struct cfs_rq *cfs_rq);
@@ -6452,6 +6615,30 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
hrtick_update(rq);
}
+static unsigned long wakeup_gran(struct sched_entity *se)
+{
+ unsigned long gran = sysctl_sched_wakeup_granularity;
+ return calc_delta_fair(gran, se);
+}
+
+static int
+wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se)
+{
+ s64 gran, vdiff = curr->vruntime - se->vruntime;
+#ifdef CONFIG_SCHED_BORE
+ if (likely(sched_bore)) vruntime_backstep(&vdiff, curr);
+#endif // CONFIG_SCHED_BORE
+
+ if (vdiff <= 0)
+ return -1;
+
+ gran = wakeup_gran(se);
+ if (vdiff > gran)
+ return 1;
+
+ return 0;
+}
+
static void set_next_buddy(struct sched_entity *se);
/*
@@ -6470,6 +6657,9 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)
@@ -6482,6 +6637,9 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)
util_est_dequeue(&rq->cfs, p);
for_each_sched_entity(se) {
@ -596,16 +524,7 @@ index 461409c0e..1293fe037 100644
cfs_rq = cfs_rq_of(se);
dequeue_entity(cfs_rq, se, flags);
@@ -7980,7 +8170,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
/*
* XXX pick_eevdf(cfs_rq) != se ?
*/
- if (pick_eevdf(cfs_rq) == pse)
+ if ((pick_eevdf(cfs_rq) == pse) && (wakeup_preempt_entity(se, pse) == 1))
goto preempt;
return;
@@ -8197,8 +8387,12 @@ static void yield_task_fair(struct rq *rq)
@@ -8206,8 +8364,12 @@ static void yield_task_fair(struct rq *rq)
/*
* Are we the only task in the tree?
*/
@ -619,7 +538,7 @@ index 461409c0e..1293fe037 100644
clear_buddies(cfs_rq, se);
@@ -8207,6 +8401,9 @@ static void yield_task_fair(struct rq *rq)
@@ -8216,6 +8378,9 @@ static void yield_task_fair(struct rq *rq)
* Update run-time statistics of the 'current'.
*/
update_curr(cfs_rq);
@ -629,17 +548,5 @@ index 461409c0e..1293fe037 100644
/*
* Tell update_rq_clock() that we've just updated,
* so we don't do microscopic update in schedule()
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 67cd7e1fd..04d065015 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2506,6 +2506,7 @@ extern const_debug unsigned int sysctl_sched_nr_migrate;
extern const_debug unsigned int sysctl_sched_migration_cost;
extern unsigned int sysctl_sched_base_slice;
+extern unsigned int sysctl_sched_wakeup_granularity;
#ifdef CONFIG_SCHED_DEBUG
extern int sysctl_resched_latency_warn_ms;
--
2.42.0.rc0.25.ga82fb66fed
2.42.0

File diff suppressed because it is too large Load Diff

View File

@ -8,8 +8,8 @@ scripts/config -k -e CONFIG_GENERIC_CPU
scripts/config -e CACHY
scripts/config -e SCHED_BORE
scripts/config -e HZ_300 --set-val HZ 1000
scripts/config -d HZ_PERIODIC -d NO_HZ_FULL -e NO_HZ_IDLE -e NO_HZ -e NO_HZ_COMMON
scripts/config -e HZ_300 --set-val HZ 500
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 -d CC_OPTIMIZE_FOR_PERFORMANCE \
@ -17,13 +17,21 @@ scripts/config -d CC_OPTIMIZE_FOR_PERFORMANCE \
scripts/config -m TCP_CONG_CUBIC \
-d DEFAULT_CUBIC \
-e TCP_CONG_BBR2 \
-e DEFAULT_BBR2 \
--set-str DEFAULT_TCP_CONG bbr2
-e TCP_CONG_BBR \
-e DEFAULT_BBR \
--set-str DEFAULT_TCP_CONG bbr
scripts/config -m NET_SCH_FQ_CODEL \
-e NET_SCH_FQ \
-d DEFAULT_FQ_CODEL \
-e DEFAULT_FQ \
--set-str DEFAULT_NET_SCH fq
scripts/config -e LRU_GEN -e LRU_GEN_ENABLED -d LRU_GEN_STATS
scripts/config -d TRANSPARENT_HUGEPAGE_ALWAYS -e TRANSPARENT_HUGEPAGE_MADVISE
scripts/config -d TRANSPARENT_HUGEPAGE_MADVISE -e TRANSPARENT_HUGEPAGE_ALWAYS
scripts/config -e PER_VMA_LOCK -d PER_VMA_LOCK_STATS
scripts/config -e DAMON \
-e DAMON_VADDR \
@ -33,13 +41,6 @@ scripts/config -e DAMON \
-e DAMON_RECLAIM \
-e DAMON_LRU_SORT
scripts/config -d ZRAM_DEF_COMP_LZORLE \
-e ZRAM_DEF_COMP_ZSTD \
--set-str ZRAM_DEF_COMP zstd \
-d ZSWAP_COMPRESSOR_DEFAULT_LZ4 \
-e ZSWAP_COMPRESSOR_DEFAULT_ZSTD \
--set-str ZSWAP_COMPRESSOR_DEFAULT zstd
scripts/config --set-val MODULE_COMPRESS_ZSTD_LEVEL 19 -e MODULE_COMPRESS_ZSTD_ULTRA --set-val MODULE_COMPRESS_ZSTD_LEVEL_ULTRA 22 --set-val ZSTD_COMP_VAL 22
scripts/config -e EFI_HANDOVER_PROTOCOL
@ -47,8 +48,11 @@ scripts/config -e EFI_HANDOVER_PROTOCOL
scripts/config -e USER_NS
scripts/config -d DEBUG_INFO \
-d DEBUG_INFO_BTF \
-d DEBUG_INFO_DWARF4 \
-d DEBUG_INFO_DWARF5 \
-d PAHOLE_HAS_SPLIT_BTF \
-d DEBUG_INFO_BTF_MODULES \
-d SLUB_DEBUG \
-d PM_DEBUG \
-d PM_ADVANCED_DEBUG \

View File

@ -7,5 +7,5 @@ rm ./linux-libc*.deb
for f in *.deb;
do
cp $f ./output/lunar_$f
cp $f ./output/mantic_$f
done

View File

@ -9,8 +9,6 @@ patch -Np1 < "../patches/0001-cachy-all.patch"
patch -Np1 < "../patches/0002-eevdf.patch"
# orig patch from cachy
patch -Np1 < "../patches/0002-eevdfbore.patch"
# orig patch from cachy
#patch -Np1 < "../patches/0003-bcachefs.patch"
# Nobara patches are here: https://github.com/sammilucia/nobara-kernel-fork
# Allow setting custom pollrates for usb devices
patch -Np1 < "../patches/0004-Allow-to-set-custom-USB-pollrate-for-specific-device.patch"

View File

@ -2,7 +2,7 @@
echo "Pika Kernel - Getting source"
wget -nv https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.5.tar.gz
tar -xf ./linux-6.5.tar.gz
wget -nv https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.5.5.tar.gz
tar -xf ./linux-6.5.5.tar.gz
cd linux-6.5
cd linux-6.5.5