Update patches/0002-bore-cachy.patch
This commit is contained in:
parent
68ebab95ca
commit
34e4b65762
@ -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 <dnaim@cachyos.org>
|
From: Eric Naim <dnaim@cachyos.org>
|
||||||
Date: Fri, 6 Dec 2024 12:24:07 +0800
|
Date: Fri, 6 Dec 2024 12:22:57 +0800
|
||||||
Subject: [PATCH] bore-cachy-5.8
|
Subject: [PATCH] bore-cachy-5.7
|
||||||
|
|
||||||
Signed-off-by: Eric Naim <dnaim@cachyos.org>
|
Signed-off-by: Eric Naim <dnaim@cachyos.org>
|
||||||
---
|
---
|
||||||
@ -11,12 +11,12 @@ Signed-off-by: Eric Naim <dnaim@cachyos.org>
|
|||||||
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 | 426 +++++++++++++++++++++++++++++++++++++
|
kernel/sched/bore.c | 407 +++++++++++++++++++++++++++++++++++++
|
||||||
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, 669 insertions(+), 18 deletions(-)
|
11 files changed, 650 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
|
||||||
|
|
||||||
@ -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..c3db800bd6e3
|
index 000000000000..f54f238ded13
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/include/linux/sched/bore.h
|
+++ b/include/linux/sched/bore.h
|
||||||
@@ -0,0 +1,40 @@
|
@@ -0,0 +1,40 @@
|
||||||
@ -67,7 +67,7 @@ index 000000000000..c3db800bd6e3
|
|||||||
+
|
+
|
||||||
+#ifndef _LINUX_SCHED_BORE_H
|
+#ifndef _LINUX_SCHED_BORE_H
|
||||||
+#define _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
|
+#ifdef CONFIG_SCHED_BORE
|
||||||
+extern u8 __read_mostly sched_bore;
|
+extern u8 __read_mostly sched_bore;
|
||||||
@ -190,17 +190,15 @@ 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..94517f26ca60
|
index 000000000000..e4a02de9db44
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/kernel/sched/bore.c
|
+++ b/kernel/sched/bore.c
|
||||||
@@ -0,0 +1,426 @@
|
@@ -0,0 +1,407 @@
|
||||||
+/*
|
+/*
|
||||||
+ * 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>
|
||||||
+ */
|
+ */
|
||||||
+#include <linux/cpuset.h>
|
+#include <linux/cpuset.h>
|
||||||
+#include <linux/rculist.h>
|
|
||||||
+#include <linux/rcupdate.h>
|
|
||||||
+#include <linux/sched/task.h>
|
+#include <linux/sched/task.h>
|
||||||
+#include <linux/sched/bore.h>
|
+#include <linux/sched/bore.h>
|
||||||
+#include "sched.h"
|
+#include "sched.h"
|
||||||
@ -349,8 +347,7 @@ index 000000000000..94517f26ca60
|
|||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+#define for_each_child(p, t) \
|
+#define for_each_child(p, t) \
|
||||||
+ list_for_each_entry_rcu(t, &(p)->children, sibling, \
|
+ list_for_each_entry(t, &(p)->children, sibling)
|
||||||
+ lockdep_is_held(&tasklist_lock))
|
|
||||||
+
|
+
|
||||||
+static u32 count_children_max2(struct task_struct *p) {
|
+static u32 count_children_max2(struct task_struct *p) {
|
||||||
+ u32 cnt = 0;
|
+ u32 cnt = 0;
|
||||||
@ -359,22 +356,6 @@ index 000000000000..94517f26ca60
|
|||||||
+ return cnt;
|
+ 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)
|
+static inline bool burst_cache_expired(struct sched_burst_cache *bc, u64 now)
|
||||||
+{return (s64)(bc->timestamp + sched_burst_cache_lifetime - now) < 0;}
|
+{return (s64)(bc->timestamp + sched_burst_cache_lifetime - now) < 0;}
|
||||||
+
|
+
|
||||||
@ -410,11 +391,12 @@ index 000000000000..94517f26ca60
|
|||||||
+static void update_child_burst_topological(
|
+static void update_child_burst_topological(
|
||||||
+ struct task_struct *p, u64 now, u32 depth, u32 *acnt, u32 *asum) {
|
+ struct task_struct *p, u64 now, u32 depth, u32 *acnt, u32 *asum) {
|
||||||
+ u32 cnt = 0, dcnt = 0, sum = 0;
|
+ u32 cnt = 0, dcnt = 0, sum = 0;
|
||||||
+ struct task_struct *child, *dec, *next;
|
+ struct task_struct *child, *dec;
|
||||||
+
|
+
|
||||||
+ for_each_child(p, child) {
|
+ for_each_child(p, child) {
|
||||||
+ dec = 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 (!dcnt || !depth) {
|
||||||
+ if (!task_is_bore_eligible(dec)) continue;
|
+ if (!task_is_bore_eligible(dec)) continue;
|
||||||
@ -441,8 +423,7 @@ index 000000000000..94517f26ca60
|
|||||||
+ u32 cnt = 0, sum = 0;
|
+ u32 cnt = 0, sum = 0;
|
||||||
+
|
+
|
||||||
+ for (struct task_struct *next;
|
+ for (struct task_struct *next;
|
||||||
+ anc != (next = rcu_dereference(anc->real_parent)) &&
|
+ anc != (next = anc->real_parent) && count_children_max2(anc) <= 1;
|
||||||
+ 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))
|
||||||
@ -480,7 +461,7 @@ index 000000000000..94517f26ca60
|
|||||||
+
|
+
|
||||||
+ if (!task_is_bore_eligible(p)) return;
|
+ if (!task_is_bore_eligible(p)) return;
|
||||||
+
|
+
|
||||||
+ rcu_read_lock();
|
+ read_lock(&tasklist_lock);
|
||||||
+ now = jiffies_to_nsecs(jiffies);
|
+ now = jiffies_to_nsecs(jiffies);
|
||||||
+ if (clone_flags & CLONE_THREAD) {
|
+ if (clone_flags & CLONE_THREAD) {
|
||||||
+ penalty = inherit_burst_tg(parent, now);
|
+ penalty = inherit_burst_tg(parent, now);
|
||||||
@ -491,7 +472,7 @@ index 000000000000..94517f26ca60
|
|||||||
+ inherit_burst_topological(parent, now):
|
+ inherit_burst_topological(parent, now):
|
||||||
+ inherit_burst_direct(parent, now);
|
+ inherit_burst_direct(parent, now);
|
||||||
+ }
|
+ }
|
||||||
+ rcu_read_unlock();
|
+ read_unlock(&tasklist_lock);
|
||||||
+
|
+
|
||||||
+ struct sched_entity *se = &p->se;
|
+ struct sched_entity *se = &p->se;
|
||||||
+ revolve_burst_penalty(se);
|
+ revolve_burst_penalty(se);
|
||||||
|
Loading…
Reference in New Issue
Block a user