diff --git a/patches/0002-bore-cachy.patch b/patches/0002-bore-cachy.patch index 4ccc3c7..957d96e 100644 --- a/patches/0002-bore-cachy.patch +++ b/patches/0002-bore-cachy.patch @@ -1,7 +1,7 @@ -From edce20799f90ec9d9fb19b4733ad1ff48fa58450 Mon Sep 17 00:00:00 2001 +From a439277c4230522e4cb7d320e524fb09c60ead98 Mon Sep 17 00:00:00 2001 From: Eric Naim -Date: Fri, 6 Dec 2024 12:24:07 +0800 -Subject: [PATCH] bore-cachy-5.8 +Date: Fri, 6 Dec 2024 12:22:57 +0800 +Subject: [PATCH] bore-cachy-5.7 Signed-off-by: Eric Naim --- @@ -11,12 +11,12 @@ Signed-off-by: Eric Naim kernel/Kconfig.hz | 17 ++ kernel/fork.c | 5 + kernel/sched/Makefile | 1 + - kernel/sched/bore.c | 426 +++++++++++++++++++++++++++++++++++++ + kernel/sched/bore.c | 407 +++++++++++++++++++++++++++++++++++++ kernel/sched/core.c | 6 + kernel/sched/debug.c | 61 +++++- kernel/sched/fair.c | 88 ++++++-- kernel/sched/sched.h | 9 + - 11 files changed, 669 insertions(+), 18 deletions(-) + 11 files changed, 650 insertions(+), 18 deletions(-) create mode 100644 include/linux/sched/bore.h create mode 100644 kernel/sched/bore.c @@ -57,7 +57,7 @@ index bb343136ddd0..c86185f87e7b 100644 diff --git a/include/linux/sched/bore.h b/include/linux/sched/bore.h new file mode 100644 -index 000000000000..c3db800bd6e3 +index 000000000000..f54f238ded13 --- /dev/null +++ b/include/linux/sched/bore.h @@ -0,0 +1,40 @@ @@ -67,7 +67,7 @@ index 000000000000..c3db800bd6e3 + +#ifndef _LINUX_SCHED_BORE_H +#define _LINUX_SCHED_BORE_H -+#define SCHED_BORE_VERSION "5.8.10" ++#define SCHED_BORE_VERSION "5.7.10" + +#ifdef CONFIG_SCHED_BORE +extern u8 __read_mostly sched_bore; @@ -190,17 +190,15 @@ index 976092b7bd45..293aad675444 100644 +obj-y += bore.o diff --git a/kernel/sched/bore.c b/kernel/sched/bore.c new file mode 100644 -index 000000000000..94517f26ca60 +index 000000000000..e4a02de9db44 --- /dev/null +++ b/kernel/sched/bore.c -@@ -0,0 +1,426 @@ +@@ -0,0 +1,407 @@ +/* + * Burst-Oriented Response Enhancer (BORE) CPU Scheduler + * Copyright (C) 2021-2024 Masahito Suzuki + */ +#include -+#include -+#include +#include +#include +#include "sched.h" @@ -349,8 +347,7 @@ index 000000000000..94517f26ca60 +} + +#define for_each_child(p, t) \ -+ list_for_each_entry_rcu(t, &(p)->children, sibling, \ -+ lockdep_is_held(&tasklist_lock)) ++ list_for_each_entry(t, &(p)->children, sibling) + +static u32 count_children_max2(struct task_struct *p) { + u32 cnt = 0; @@ -359,22 +356,6 @@ index 000000000000..94517f26ca60 + return cnt; +} + -+static u32 count_children_max2_head( -+ struct task_struct *p, struct task_struct **first) { -+ struct list_head *head = &p->children; -+ struct task_struct *cursor; -+ u32 cnt = 0; -+ *first = cursor = list_first_or_null_rcu(head, struct task_struct, sibling); -+ if (cursor) { -+ cnt++; -+ list_for_each_entry_continue_rcu(cursor, head, sibling) { -+ cnt++; -+ break; -+ } -+ } -+ return cnt; -+} -+ +static inline bool burst_cache_expired(struct sched_burst_cache *bc, u64 now) +{return (s64)(bc->timestamp + sched_burst_cache_lifetime - now) < 0;} + @@ -410,11 +391,12 @@ index 000000000000..94517f26ca60 +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, *next; ++ struct task_struct *child, *dec; + + for_each_child(p, child) { + dec = child; -+ while ((dcnt = count_children_max2_head(dec, &next)) == 1) {dec = next;} ++ while ((dcnt = count_children_max2(dec)) == 1) ++ dec = list_first_entry(&dec->children, struct task_struct, sibling); + + if (!dcnt || !depth) { + if (!task_is_bore_eligible(dec)) continue; @@ -441,8 +423,7 @@ index 000000000000..94517f26ca60 + u32 cnt = 0, sum = 0; + + for (struct task_struct *next; -+ anc != (next = rcu_dereference(anc->real_parent)) && -+ count_children_max2(anc) <= 1; ++ anc != (next = anc->real_parent) && count_children_max2(anc) <= 1; + anc = next) {} + + if (burst_cache_expired(&anc->se.child_burst, now)) @@ -480,7 +461,7 @@ index 000000000000..94517f26ca60 + + if (!task_is_bore_eligible(p)) return; + -+ rcu_read_lock(); ++ read_lock(&tasklist_lock); + now = jiffies_to_nsecs(jiffies); + if (clone_flags & CLONE_THREAD) { + penalty = inherit_burst_tg(parent, now); @@ -491,7 +472,7 @@ index 000000000000..94517f26ca60 + inherit_burst_topological(parent, now): + inherit_burst_direct(parent, now); + } -+ rcu_read_unlock(); ++ read_unlock(&tasklist_lock); + + struct sched_entity *se = &p->se; + revolve_burst_penalty(se); @@ -1016,4 +997,4 @@ index c5d6012794de..ce3804c6fa5c 100644 #ifdef CONFIG_SCHED_DEBUG extern int sysctl_resched_latency_warn_ms; -- -2.47.1 +2.47.1 \ No newline at end of file