linux58-tkg: replace our PDS implementation with Project C's

This commit is contained in:
Tk-Glitch 2020-09-06 19:44:52 +02:00
parent 994fcbee93
commit a59c00ab6f
6 changed files with 14 additions and 8647 deletions

View File

@ -69,9 +69,7 @@ source=("https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${_basekernel}.tar.x
#0004-glitched-ondemand-muqss.patch #0004-glitched-ondemand-muqss.patch
#0004-glitched-muqss.patch #0004-glitched-muqss.patch
#0004-5.8-ck1.patch #0004-5.8-ck1.patch
0005-glitched-ondemand-pds.patch
0005-glitched-pds.patch 0005-glitched-pds.patch
0005-v5.8_undead-pds099o.patch
0006-add-acs-overrides_iommu.patch 0006-add-acs-overrides_iommu.patch
0007-v5.8-fsync.patch 0007-v5.8-fsync.patch
#0008-5.8-bcachefs.patch #0008-5.8-bcachefs.patch
@ -92,9 +90,7 @@ sha256sums=('e7f75186aa0642114af8f19d99559937300ca27acaf7451b36d4f9b0f85cf1f5'
'd02bf5ca08fd610394b9d3a0c3b176d74af206f897dee826e5cbaec97bb4a4aa' 'd02bf5ca08fd610394b9d3a0c3b176d74af206f897dee826e5cbaec97bb4a4aa'
'd6cde733ad3bd8287528f69c16debfa75e7e43e8bb4c26a8ca9e1a3a7e303a02' 'd6cde733ad3bd8287528f69c16debfa75e7e43e8bb4c26a8ca9e1a3a7e303a02'
'7058e57fd68367b029adc77f2a82928f1433daaf02c8c279cb2d13556c8804d7' '7058e57fd68367b029adc77f2a82928f1433daaf02c8c279cb2d13556c8804d7'
'62496f9ca788996181ef145f96ad26291282fcc3fb95cdc04080dcf84365be33' '87bca363416655bc865fcb2cc0d1532cb010a61d9b9f625e3c15cd12eeee3a59'
'7fd8e776209dac98627453fda754bdf9aff4a09f27cb0b3766d7983612eb3c74'
'31b172eb6a0c635a8d64cc1c2e8181d9f928ee991bd44f6e556d1713b815f8d9'
'19661ec0d39f9663452b34433214c755179894528bf73a42f6ba52ccf572832a' '19661ec0d39f9663452b34433214c755179894528bf73a42f6ba52ccf572832a'
'cd225e86d72eaf6c31ef3d7b20df397f4cc44ddd04389850691292cdf292b204' 'cd225e86d72eaf6c31ef3d7b20df397f4cc44ddd04389850691292cdf292b204'
'9fad4a40449e09522899955762c8928ae17f4cdaa16e01239fd12592e9d58177' '9fad4a40449e09522899955762c8928ae17f4cdaa16e01239fd12592e9d58177'

View File

@ -2,13 +2,9 @@
### MuQSS is not an available option for this revision yet ### MuQSS is not an available option for this revision yet
A custom Linux kernel 5.8.y with specific PDS and Project C / BMQ CPU schedulers related patchsets selector (stock CFS is also an option) and added tweaks for a nice interactivity/performance balance, aiming for the best gaming experience. A custom Linux kernel 5.8.y with specific Project C / PDS & BMQ CPU schedulers related patchsets selector (stock CFS is also an option) and added tweaks for a nice interactivity/performance balance, aiming for the best gaming experience.
Project C / BMQ : http://cchalpha.blogspot.com/ Project C / PDS & BMQ : http://cchalpha.blogspot.com/
PDS-mq was originally created by Alfred Chen : http://cchalpha.blogspot.com/
While he dropped it with kernel 5.1 in favor of its BMQ evolution/rework, my pretty bad gaming experiences with BMQ up to this point convinced me to keep PDS afloat for as long as it'll make sense/I'll be able to.
Various personalization options available and userpatches support (put your own patches in the same dir as the PKGBUILD, with the ".mypatch" extension). The options built with are installed to `/usr/share/doc/$pkgbase/customization.cfg`, where `$pkgbase` is the package name. Various personalization options available and userpatches support (put your own patches in the same dir as the PKGBUILD, with the ".mypatch" extension). The options built with are installed to `/usr/share/doc/$pkgbase/customization.cfg`, where `$pkgbase` is the package name.

View File

@ -33,7 +33,7 @@ _tkg_initscript() {
# CPU SCHED selector # CPU SCHED selector
if [ -z "$_cpusched" ] && [ ! -e "$_where"/cpuschedset ]; then if [ -z "$_cpusched" ] && [ ! -e "$_where"/cpuschedset ]; then
plain "What CPU sched variant do you want to build/install?" plain "What CPU sched variant do you want to build/install?"
read -rp "`echo $' > 1.PDS\n 2.Project C / BMQ\n 3.CFS\nchoice[1-3?]: '`" CONDITION; read -rp "`echo $' > 1.Project C / PDS\n 2.Project C / BMQ\n 3.CFS\nchoice[1-3?]: '`" CONDITION;
if [ "$CONDITION" = "2" ]; then if [ "$CONDITION" = "2" ]; then
echo "_cpusched=\"bmq\"" > "$_where"/cpuschedset echo "_cpusched=\"bmq\"" > "$_where"/cpuschedset
elif [ "$CONDITION" = "3" ]; then elif [ "$CONDITION" = "3" ]; then
@ -178,11 +178,11 @@ _tkg_srcprep() {
elif [ "${_cpusched}" = "pds" ]; then elif [ "${_cpusched}" = "pds" ]; then
# PDS-mq # PDS-mq
msg2 "Applying PDS base patch" msg2 "Applying PDS base patch"
patch -Np1 -i "$srcdir"/0005-v5.8_undead-pds099o.patch patch -Np1 -i "$srcdir"/0009-prjc_v5.8-r2.patch
if [ "${_aggressive_ondemand}" = "true" ]; then if [ "${_aggressive_ondemand}" = "true" ]; then
msg2 "Applying PDS agressive ondemand governor patch" msg2 "Applying PDS agressive ondemand governor patch"
patch -Np1 -i "$srcdir"/0005-glitched-ondemand-pds.patch patch -Np1 -i "$srcdir"/0009-glitched-ondemand-bmq.patch
fi fi
msg2 "Applying Glitched PDS patch" msg2 "Applying Glitched PDS patch"
@ -295,11 +295,14 @@ _tkg_srcprep() {
echo "CONFIG_SCHED_MUQSS=y" >> ./.config echo "CONFIG_SCHED_MUQSS=y" >> ./.config
elif [ "${_cpusched}" = "pds" ]; then elif [ "${_cpusched}" = "pds" ]; then
# PDS default config # PDS default config
echo "CONFIG_SCHED_ALT=y" >> ./.config
echo "CONFIG_SCHED_PDS=y" >> ./.config echo "CONFIG_SCHED_PDS=y" >> ./.config
echo "# CONFIG_SCHED_BMQ is not set" >> ./.config
elif [ "${_cpusched}" = "bmq" ]; then elif [ "${_cpusched}" = "bmq" ]; then
# BMQ default config # BMQ default config
echo "CONFIG_SCHED_ALT=y" >> ./.config echo "CONFIG_SCHED_ALT=y" >> ./.config
echo "CONFIG_SCHED_BMQ=y" >> ./.config echo "CONFIG_SCHED_BMQ=y" >> ./.config
echo "# CONFIG_SCHED_PDS is not set" >> ./.config
fi fi
if [ "${_cpusched}" = "MuQSS" ] || [ "${_cpusched}" = "pds" ] || [ "${_cpusched}" = "bmq" ]; then if [ "${_cpusched}" = "MuQSS" ] || [ "${_cpusched}" = "pds" ] || [ "${_cpusched}" = "bmq" ]; then
@ -329,7 +332,7 @@ _tkg_srcprep() {
fi fi
fi fi
if [ "$CONDITION0" = "0" ]; then if [ "$CONDITION0" = "0" ]; then
if [ "${_cpusched}" = "bmq" ]; then if [ "${_cpusched}" = "bmq" ] || [ "${_cpusched}" = "pds" ]; then
sed -i -e 's/int sched_yield_type __read_mostly = 1;/int sched_yield_type __read_mostly = 0;/' ./kernel/sched/alt_core.c sed -i -e 's/int sched_yield_type __read_mostly = 1;/int sched_yield_type __read_mostly = 0;/' ./kernel/sched/alt_core.c
else else
sed -i -e 's/int sched_yield_type __read_mostly = 1;/int sched_yield_type __read_mostly = 0;/' ./kernel/sched/"${_cpusched}".c sed -i -e 's/int sched_yield_type __read_mostly = 1;/int sched_yield_type __read_mostly = 0;/' ./kernel/sched/"${_cpusched}".c
@ -337,7 +340,7 @@ _tkg_srcprep() {
elif [ "$CONDITION0" = "1" ]; then elif [ "$CONDITION0" = "1" ]; then
msg2 "Using default CPU sched yield type (1)" msg2 "Using default CPU sched yield type (1)"
elif [ "$CONDITION0" = "2" ]; then elif [ "$CONDITION0" = "2" ]; then
if [ "${_cpusched}" = "bmq" ]; then if [ "${_cpusched}" = "bmq" ] || [ "${_cpusched}" = "pds" ]; then
sed -i -e 's/int sched_yield_type __read_mostly = 1;/int sched_yield_type __read_mostly = 2;/' ./kernel/sched/alt_core.c sed -i -e 's/int sched_yield_type __read_mostly = 1;/int sched_yield_type __read_mostly = 2;/' ./kernel/sched/alt_core.c
else else
sed -i -e 's/int sched_yield_type __read_mostly = 1;/int sched_yield_type __read_mostly = 2;/' ./kernel/sched/"${_cpusched}".c sed -i -e 's/int sched_yield_type __read_mostly = 1;/int sched_yield_type __read_mostly = 2;/' ./kernel/sched/"${_cpusched}".c
@ -345,10 +348,8 @@ _tkg_srcprep() {
else else
if [ "${_cpusched}" = "MuQSS" ]; then if [ "${_cpusched}" = "MuQSS" ]; then
msg2 "Using default CPU sched yield type (1)" msg2 "Using default CPU sched yield type (1)"
elif [ "${_cpusched}" = "bmq" ]; then elif [ "${_cpusched}" = "bmq" ] || [ "${_cpusched}" = "pds" ]; then
sed -i -e 's/int sched_yield_type __read_mostly = 1;/int sched_yield_type __read_mostly = 0;/' ./kernel/sched/alt_core.c sed -i -e 's/int sched_yield_type __read_mostly = 1;/int sched_yield_type __read_mostly = 0;/' ./kernel/sched/alt_core.c
else
sed -i -e 's/int sched_yield_type __read_mostly = 1;/int sched_yield_type __read_mostly = 0;/' ./kernel/sched/"${_cpusched}".c
fi fi
fi fi
fi fi
@ -388,13 +389,11 @@ _tkg_srcprep() {
if [ "$_rrvalue" != "default" ]; then if [ "$_rrvalue" != "default" ]; then
if [ "${_cpusched}" = "MuQSS" ]; then if [ "${_cpusched}" = "MuQSS" ]; then
sed -i -e "s/int rr_interval __read_mostly = 6;/int rr_interval __read_mostly = ${_rrvalue};/" ./kernel/sched/"${_cpusched}".c sed -i -e "s/int rr_interval __read_mostly = 6;/int rr_interval __read_mostly = ${_rrvalue};/" ./kernel/sched/"${_cpusched}".c
elif [ "${_cpusched}" = "pds" ]; then elif [ "${_cpusched}" = "bmq" ] || [ "${_cpusched}" = "pds" ]; then
sed -i -e "s/#define SCHED_DEFAULT_RR (4)/#define SCHED_DEFAULT_RR (${_rrvalue})/" ./kernel/sched/"${_cpusched}".c
elif [ "${_cpusched}" = "bmq" ]; then
sed -i -e "s/u64 sched_timeslice_ns __read_mostly = (4 * 1000 * 1000);/u64 sched_timeslice_ns __read_mostly = (${_rrvalue} * 1000 * 1000);/" ./kernel/sched/alt_core.c sed -i -e "s/u64 sched_timeslice_ns __read_mostly = (4 * 1000 * 1000);/u64 sched_timeslice_ns __read_mostly = (${_rrvalue} * 1000 * 1000);/" ./kernel/sched/alt_core.c
fi fi
else else
if [ "${_cpusched}" = "bmq" ]; then if [ "${_cpusched}" = "bmq" ] || [ "${_cpusched}" = "pds" ]; then
sed -i -e "s/u64 sched_timeslice_ns __read_mostly = (4 * 1000 * 1000);/u64 sched_timeslice_ns __read_mostly = (2 * 1000 * 1000);/" ./kernel/sched/alt_core.c sed -i -e "s/u64 sched_timeslice_ns __read_mostly = (4 * 1000 * 1000);/u64 sched_timeslice_ns __read_mostly = (2 * 1000 * 1000);/" ./kernel/sched/alt_core.c
fi fi
fi fi

View File

@ -1,18 +0,0 @@
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 6b423eebfd5d..61e3271675d6 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -21,10 +21,10 @@
#include "cpufreq_ondemand.h"
/* On-demand governor macros */
-#define DEF_FREQUENCY_UP_THRESHOLD (63)
-#define DEF_SAMPLING_DOWN_FACTOR (1)
+#define DEF_FREQUENCY_UP_THRESHOLD (55)
+#define DEF_SAMPLING_DOWN_FACTOR (5)
#define MAX_SAMPLING_DOWN_FACTOR (100000)
-#define MICRO_FREQUENCY_UP_THRESHOLD (95)
+#define MICRO_FREQUENCY_UP_THRESHOLD (63)
#define MICRO_FREQUENCY_MIN_SAMPLE_RATE (10000)
#define MIN_FREQUENCY_UP_THRESHOLD (1)
#define MAX_FREQUENCY_UP_THRESHOLD (100)

View File

@ -88,79 +88,3 @@ index 9270a4370d54..30d01e647417 100644
/* /*
* The total number of pages which are beyond the high watermark within all * The total number of pages which are beyond the high watermark within all
* zones. * zones.
diff --git a/init/Kconfig b/init/Kconfig
index 11fd9b502d06..e9bc34d3019b 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -715,6 +715,7 @@ menu "Scheduler features"
config UCLAMP_TASK
bool "Enable utilization clamping for RT/FAIR tasks"
depends on CPU_FREQ_GOV_SCHEDUTIL
+ depends on !SCHED_PDS
help
This feature enables the scheduler to track the clamped utilization
of each CPU based on RUNNABLE tasks scheduled on that CPU.
@@ -948,7 +948,6 @@ config CGROUP_DEVICE
config CGROUP_CPUACCT
bool "Simple CPU accounting controller"
- depends on !SCHED_PDS
help
Provides a simple controller for monitoring the
total CPU consumed by the tasks in a cgroup.
diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
index b23231bae996..cab4e5c5b38e 100644
--- a/kernel/sched/Makefile
+++ b/kernel/sched/Makefile
@@ -24,13 +24,13 @@ obj-y += fair.o rt.o deadline.o
obj-$(CONFIG_SMP) += cpudeadline.o topology.o stop_task.o
obj-$(CONFIG_SCHED_AUTOGROUP) += autogroup.o
obj-$(CONFIG_SCHED_DEBUG) += debug.o
-obj-$(CONFIG_CGROUP_CPUACCT) += cpuacct.o
endif
obj-y += loadavg.o clock.o cputime.o
obj-y += idle.o
obj-y += wait.o wait_bit.o swait.o completion.o
obj-$(CONFIG_SMP) += cpupri.o pelt.o
obj-$(CONFIG_SCHEDSTATS) += stats.o
+obj-$(CONFIG_CGROUP_CPUACCT) += cpuacct.o
obj-$(CONFIG_CPU_FREQ) += cpufreq.o
obj-$(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) += cpufreq_schedutil.o
obj-$(CONFIG_MEMBARRIER) += membarrier.o
diff --git a/kernel/sched/pds.c b/kernel/sched/pds.c
index 9281ad164..f09a609cf 100644
--- a/kernel/sched/pds.c
+++ b/kernel/sched/pds.c
@@ -81,6 +81,18 @@ enum {
NR_CPU_AFFINITY_CHK_LEVEL
};
+/*
+ * This allows printing both to /proc/sched_debug and
+ * to the console
+ */
+#define SEQ_printf(m, x...) \
+ do { \
+ if (m) \
+ seq_printf(m, x); \
+ else \
+ pr_cont(x); \
+ } while (0)
+
static inline void print_scheduler_version(void)
{
printk(KERN_INFO "pds: PDS-mq CPU Scheduler 0.99o by Alfred Chen.\n");
@@ -6353,7 +6365,10 @@ void ia64_set_curr_task(int cpu, struct task_struct *p)
#ifdef CONFIG_SCHED_DEBUG
void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
struct seq_file *m)
-{}
+{
+ SEQ_printf(m, "%s (%d, #threads: %d)\n", p->comm, task_pid_nr_ns(p, ns),
+ get_nr_threads(p));
+}
void proc_sched_set_task(struct task_struct *p)
{}

File diff suppressed because it is too large Load Diff