Update patches/0002-bore-cachy.patch

This commit is contained in:
ferreo 2024-12-06 00:24:29 +01:00
parent 61f38f9479
commit b7bfcd93db

View File

@ -1,6 +1,6 @@
From 7e3749e5ee5c5e1e078dde5ad95bf68d7dd510b3 Mon Sep 17 00:00:00 2001 From f88ecfd06f1641c3b03ad36b5ed0e3f62aa6972d Mon Sep 17 00:00:00 2001
From: Piotr Gorski <lucjan.lucjanov@gmail.com> From: Piotr Gorski <lucjan.lucjanov@gmail.com>
Date: Thu, 5 Dec 2024 13:24:02 +0100 Date: Thu, 5 Dec 2024 22:52: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>
@ -11,17 +11,17 @@ Signed-off-by: Piotr Gorski <lucjan.lucjanov@gmail.com>
kernel/Kconfig.hz | 17 ++ kernel/Kconfig.hz | 17 ++
kernel/fork.c | 5 + kernel/fork.c | 5 +
kernel/sched/Makefile | 1 + kernel/sched/Makefile | 1 +
kernel/sched/bore.c | 412 +++++++++++++++++++++++++++++++++++++ kernel/sched/bore.c | 410 +++++++++++++++++++++++++++++++++++++
kernel/sched/core.c | 6 + kernel/sched/core.c | 6 +
kernel/sched/debug.c | 61 +++++- kernel/sched/debug.c | 61 +++++-
kernel/sched/fair.c | 88 ++++++-- kernel/sched/fair.c | 88 ++++++--
kernel/sched/sched.h | 9 + kernel/sched/sched.h | 9 +
11 files changed, 655 insertions(+), 18 deletions(-) 11 files changed, 653 insertions(+), 18 deletions(-)
create mode 100644 include/linux/sched/bore.h create mode 100644 include/linux/sched/bore.h
create mode 100644 kernel/sched/bore.c create mode 100644 kernel/sched/bore.c
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 bb343136ddd0..c86185f87e7b 100644 index bb343136d..c86185f87 100644
--- a/include/linux/sched.h --- a/include/linux/sched.h
+++ b/include/linux/sched.h +++ b/include/linux/sched.h
@@ -538,6 +538,14 @@ struct sched_statistics { @@ -538,6 +538,14 @@ struct sched_statistics {
@ -57,7 +57,7 @@ index bb343136ddd0..c86185f87e7b 100644
diff --git a/include/linux/sched/bore.h b/include/linux/sched/bore.h diff --git a/include/linux/sched/bore.h b/include/linux/sched/bore.h
new file mode 100644 new file mode 100644
index 000000000000..14d8f260ad6c index 000000000..14d8f260a
--- /dev/null --- /dev/null
+++ b/include/linux/sched/bore.h +++ b/include/linux/sched/bore.h
@@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
@ -102,10 +102,10 @@ index 000000000000..14d8f260ad6c
+#endif // CONFIG_SCHED_BORE +#endif // CONFIG_SCHED_BORE
+#endif // _LINUX_SCHED_BORE_H +#endif // _LINUX_SCHED_BORE_H
diff --git a/init/Kconfig b/init/Kconfig diff --git a/init/Kconfig b/init/Kconfig
index 504e8a7c4e2a..43daffa3ee03 100644 index 857869dbc..9bd4551a7 100644
--- a/init/Kconfig --- a/init/Kconfig
+++ b/init/Kconfig +++ b/init/Kconfig
@@ -1360,6 +1360,23 @@ config CHECKPOINT_RESTORE @@ -1361,6 +1361,23 @@ config CHECKPOINT_RESTORE
If unsure, say N here. If unsure, say N here.
@ -130,7 +130,7 @@ index 504e8a7c4e2a..43daffa3ee03 100644
bool "Automatic process group scheduling" bool "Automatic process group scheduling"
select CGROUPS select CGROUPS
diff --git a/kernel/Kconfig.hz b/kernel/Kconfig.hz diff --git a/kernel/Kconfig.hz b/kernel/Kconfig.hz
index 0f78364efd4f..83a6b919ab29 100644 index 0f78364ef..83a6b919a 100644
--- a/kernel/Kconfig.hz --- a/kernel/Kconfig.hz
+++ b/kernel/Kconfig.hz +++ b/kernel/Kconfig.hz
@@ -79,5 +79,22 @@ config HZ @@ -79,5 +79,22 @@ config HZ
@ -157,7 +157,7 @@ index 0f78364efd4f..83a6b919ab29 100644
config SCHED_HRTICK config SCHED_HRTICK
def_bool HIGH_RES_TIMERS def_bool HIGH_RES_TIMERS
diff --git a/kernel/fork.c b/kernel/fork.c diff --git a/kernel/fork.c b/kernel/fork.c
index 8287afdd01d2..e4274ce3ac32 100644 index e97e527ce..d40105f4b 100644
--- a/kernel/fork.c --- a/kernel/fork.c
+++ b/kernel/fork.c +++ b/kernel/fork.c
@@ -117,6 +117,8 @@ @@ -117,6 +117,8 @@
@ -169,7 +169,7 @@ index 8287afdd01d2..e4274ce3ac32 100644
#include <trace/events/sched.h> #include <trace/events/sched.h>
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
@@ -2352,6 +2354,9 @@ __latent_entropy struct task_struct *copy_process( @@ -2372,6 +2374,9 @@ __latent_entropy struct task_struct *copy_process(
retval = sched_fork(clone_flags, p); retval = sched_fork(clone_flags, p);
if (retval) if (retval)
goto bad_fork_cleanup_policy; goto bad_fork_cleanup_policy;
@ -180,7 +180,7 @@ index 8287afdd01d2..e4274ce3ac32 100644
retval = perf_event_init_task(p, clone_flags); retval = perf_event_init_task(p, clone_flags);
if (retval) if (retval)
diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
index 976092b7bd45..293aad675444 100644 index 976092b7b..293aad675 100644
--- a/kernel/sched/Makefile --- a/kernel/sched/Makefile
+++ b/kernel/sched/Makefile +++ b/kernel/sched/Makefile
@@ -32,3 +32,4 @@ obj-y += core.o @@ -32,3 +32,4 @@ obj-y += core.o
@ -190,10 +190,10 @@ index 976092b7bd45..293aad675444 100644
+obj-y += bore.o +obj-y += bore.o
diff --git a/kernel/sched/bore.c b/kernel/sched/bore.c diff --git a/kernel/sched/bore.c b/kernel/sched/bore.c
new file mode 100644 new file mode 100644
index 000000000000..96a9177f003a index 000000000..e3e7ef8ea
--- /dev/null --- /dev/null
+++ b/kernel/sched/bore.c +++ b/kernel/sched/bore.c
@@ -0,0 +1,412 @@ @@ -0,0 +1,410 @@
+/* +/*
+ * Burst-Oriented Response Enhancer (BORE) CPU Scheduler + * Burst-Oriented Response Enhancer (BORE) CPU Scheduler
+ * Copyright (C) 2021-2024 Masahito Suzuki <firelzrd@gmail.com> + * Copyright (C) 2021-2024 Masahito Suzuki <firelzrd@gmail.com>
@ -349,8 +349,6 @@ index 000000000000..96a9177f003a
+#define for_each_child(p, t) \ +#define for_each_child(p, t) \
+ list_for_each_entry(t, &(p)->children, sibling) + list_for_each_entry(t, &(p)->children, sibling)
+ +
+#define has_no_child(p) list_empty(&(p)->children)
+
+static u32 count_children_max2(struct task_struct *p) { +static u32 count_children_max2(struct task_struct *p) {
+ u32 cnt = 0; + u32 cnt = 0;
+ struct task_struct *child; + struct task_struct *child;
@ -427,7 +425,7 @@ index 000000000000..96a9177f003a
+ u32 cnt = 0, sum = 0; + u32 cnt = 0, sum = 0;
+ +
+ for (struct task_struct *next; + for (struct task_struct *next;
+ anc != (next = anc->real_parent) && has_no_child(anc); + anc != (next = anc->real_parent) && count_children_max2(anc) <= 1;
+ anc = next) {} + anc = next) {}
+ +
+ if (burst_cache_expired(&anc->se.child_burst, now)) + if (burst_cache_expired(&anc->se.child_burst, now))
@ -607,7 +605,7 @@ index 000000000000..96a9177f003a
+#endif // CONFIG_SYSCTL +#endif // CONFIG_SYSCTL
+#endif // CONFIG_SCHED_BORE +#endif // CONFIG_SCHED_BORE
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 a1c353a62c56..4dc0c98c1afd 100644 index a1c353a62..4dc0c98c1 100644
--- a/kernel/sched/core.c --- a/kernel/sched/core.c
+++ b/kernel/sched/core.c +++ b/kernel/sched/core.c
@@ -97,6 +97,8 @@ @@ -97,6 +97,8 @@
@ -631,7 +629,7 @@ index a1c353a62c56..4dc0c98c1afd 100644
#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 f4035c7a0fa1..0edb3a216f5d 100644 index f4035c7a0..0edb3a216 100644
--- a/kernel/sched/debug.c --- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c +++ b/kernel/sched/debug.c
@@ -167,7 +167,53 @@ static const struct file_operations sched_feat_fops = { @@ -167,7 +167,53 @@ static const struct file_operations sched_feat_fops = {
@ -739,7 +737,7 @@ index f4035c7a0fa1..0edb3a216f5d 100644
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 54e7c4c3e2c5..94c54154a175 100644 index 54e7c4c3e..94c54154a 100644
--- a/kernel/sched/fair.c --- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c +++ b/kernel/sched/fair.c
@@ -55,6 +55,8 @@ @@ -55,6 +55,8 @@
@ -973,7 +971,7 @@ index 54e7c4c3e2c5..94c54154a175 100644
} }
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index c5d6012794de..ce3804c6fa5c 100644 index c5d601279..ce3804c6f 100644
--- a/kernel/sched/sched.h --- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h +++ b/kernel/sched/sched.h
@@ -2075,7 +2075,11 @@ static inline void update_sched_domain_debugfs(void) { } @@ -2075,7 +2075,11 @@ static inline void update_sched_domain_debugfs(void) { }
@ -1003,3 +1001,4 @@ index c5d6012794de..ce3804c6fa5c 100644
extern int sysctl_resched_latency_warn_ms; extern int sysctl_resched_latency_warn_ms;
-- --
2.47.1 2.47.1