linux58-tkg: Bring undead PDS back for 5.8.y (renamed upds)

It seems Project C PDS doesn't perform anywhere as good currently
master
Tk-Glitch 2020-09-08 22:36:47 +07:00
parent 07ebc66bfd
commit 15169ce848
6 changed files with 8762 additions and 8 deletions

@ -45,7 +45,7 @@ else
fi fi
pkgname=("${pkgbase}" "${pkgbase}-headers") pkgname=("${pkgbase}" "${pkgbase}-headers")
pkgver="${_basekernel}"."${_sub}" pkgver="${_basekernel}"."${_sub}"
pkgrel=12 pkgrel=13
pkgdesc='Linux-tkg' pkgdesc='Linux-tkg'
arch=('x86_64') # no i686 in here arch=('x86_64') # no i686 in here
url="http://www.kernel.org/" url="http://www.kernel.org/"
@ -69,6 +69,9 @@ 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-undead-glitched-ondemand-pds.patch
0005-undead-glitched-pds.patch
0005-v5.8_undead-pds099o.patch
0005-glitched-pds.patch 0005-glitched-pds.patch
0006-add-acs-overrides_iommu.patch 0006-add-acs-overrides_iommu.patch
0007-v5.8-fsync.patch 0007-v5.8-fsync.patch
@ -90,6 +93,9 @@ sha256sums=('e7f75186aa0642114af8f19d99559937300ca27acaf7451b36d4f9b0f85cf1f5'
'd02bf5ca08fd610394b9d3a0c3b176d74af206f897dee826e5cbaec97bb4a4aa' 'd02bf5ca08fd610394b9d3a0c3b176d74af206f897dee826e5cbaec97bb4a4aa'
'd6cde733ad3bd8287528f69c16debfa75e7e43e8bb4c26a8ca9e1a3a7e303a02' 'd6cde733ad3bd8287528f69c16debfa75e7e43e8bb4c26a8ca9e1a3a7e303a02'
'7058e57fd68367b029adc77f2a82928f1433daaf02c8c279cb2d13556c8804d7' '7058e57fd68367b029adc77f2a82928f1433daaf02c8c279cb2d13556c8804d7'
'62496f9ca788996181ef145f96ad26291282fcc3fb95cdc04080dcf84365be33'
'7fd8e776209dac98627453fda754bdf9aff4a09f27cb0b3766d7983612eb3c74'
'31b172eb6a0c635a8d64cc1c2e8181d9f928ee991bd44f6e556d1713b815f8d9'
'87bca363416655bc865fcb2cc0d1532cb010a61d9b9f625e3c15cd12eeee3a59' '87bca363416655bc865fcb2cc0d1532cb010a61d9b9f625e3c15cd12eeee3a59'
'19661ec0d39f9663452b34433214c755179894528bf73a42f6ba52ccf572832a' '19661ec0d39f9663452b34433214c755179894528bf73a42f6ba52ccf572832a'
'cd225e86d72eaf6c31ef3d7b20df397f4cc44ddd04389850691292cdf292b204' 'cd225e86d72eaf6c31ef3d7b20df397f4cc44ddd04389850691292cdf292b204'

@ -2,9 +2,13 @@
### 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 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. A custom Linux kernel 5.8.y with specific Undead PDS, 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 / PDS & BMQ : http://cchalpha.blogspot.com/ - Undead PDS : 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.
- Project C / PDS & BMQ : http://cchalpha.blogspot.com/
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.

@ -33,17 +33,21 @@ _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.Project C / PDS\n 2.Project C / BMQ\n 3.CFS\nchoice[1-3?]: '`" CONDITION; read -rp "`echo $' > 1.Undead PDS (TkG)\n 2.Project C / PDS\n 3.Project C / BMQ\n 4.CFS\nchoice[1-3?]: '`" CONDITION;
if [ "$CONDITION" = "2" ]; then if [ "$CONDITION" = "2" ]; then
echo "_cpusched=\"bmq\"" > "$_where"/cpuschedset echo "_cpusched=\"pds\"" > "$_where"/cpuschedset
elif [ "$CONDITION" = "3" ]; then elif [ "$CONDITION" = "3" ]; then
echo "_cpusched=\"bmq\"" > "$_where"/cpuschedset
elif [ "$CONDITION" = "4" ]; then
echo "_cpusched=\"cfs\"" > "$_where"/cpuschedset echo "_cpusched=\"cfs\"" > "$_where"/cpuschedset
else else
echo "_cpusched=\"pds\"" > "$_where"/cpuschedset echo "_cpusched=\"upds\"" > "$_where"/cpuschedset
fi fi
if [ -n "$_custom_pkgbase" ]; then if [ -n "$_custom_pkgbase" ]; then
echo "_custom_pkgbase=\"${_custom_pkgbase}\"" >> "$_where"/cpuschedset echo "_custom_pkgbase=\"${_custom_pkgbase}\"" >> "$_where"/cpuschedset
fi fi
elif [ "$_cpusched" = "upds" ]; then
echo "_cpusched=\"upds\"" > "$_where"/cpuschedset
elif [ "$_cpusched" = "pds" ]; then elif [ "$_cpusched" = "pds" ]; then
echo "_cpusched=\"pds\"" > "$_where"/cpuschedset echo "_cpusched=\"pds\"" > "$_where"/cpuschedset
elif [ "$_cpusched" = "cfs" ]; then elif [ "$_cpusched" = "cfs" ]; then
@ -188,6 +192,19 @@ _tkg_srcprep() {
msg2 "Applying Glitched PDS patch" msg2 "Applying Glitched PDS patch"
patch -Np1 -i "$srcdir"/0005-glitched-pds.patch patch -Np1 -i "$srcdir"/0005-glitched-pds.patch
elif [ "${_cpusched}" = "upds" ]; then
# PDS-mq
msg2 "Applying PDS base patch"
patch -Np1 -i "$srcdir"/0005-v5.8_undead-pds099o.patch
if [ "${_aggressive_ondemand}" = "true" ]; then
msg2 "Applying PDS agressive ondemand governor patch"
patch -Np1 -i "$srcdir"/0005-undead-glitched-ondemand-pds.patch
fi
msg2 "Applying Glitched PDS patch"
patch -Np1 -i "$srcdir"/0005-undead-glitched-pds.patch
elif [ "${_cpusched}" = "bmq" ]; then elif [ "${_cpusched}" = "bmq" ]; then
# Project C / BMQ # Project C / BMQ
msg2 "Applying Project C / BMQ base patch" msg2 "Applying Project C / BMQ base patch"
@ -293,6 +310,9 @@ _tkg_srcprep() {
if [ "${_cpusched}" = "MuQSS" ]; then if [ "${_cpusched}" = "MuQSS" ]; then
# MuQSS default config # MuQSS default config
echo "CONFIG_SCHED_MUQSS=y" >> ./.config echo "CONFIG_SCHED_MUQSS=y" >> ./.config
elif [ "${_cpusched}" = "upds" ]; then
# PDS default config
echo "CONFIG_SCHED_PDS=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_ALT=y" >> ./.config
@ -305,7 +325,7 @@ _tkg_srcprep() {
echo "# CONFIG_SCHED_PDS is not set" >> ./.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" ] || [ "${_cpusched}" = "upds" ]; then
# Disable CFS # Disable CFS
sed -i -e 's/CONFIG_FAIR_GROUP_SCHED=y/# CONFIG_FAIR_GROUP_SCHED is not set/' ./.config sed -i -e 's/CONFIG_FAIR_GROUP_SCHED=y/# CONFIG_FAIR_GROUP_SCHED is not set/' ./.config
sed -i -e 's/CONFIG_CFS_BANDWIDTH=y/# CONFIG_CFS_BANDWIDTH is not set/' ./.config sed -i -e 's/CONFIG_CFS_BANDWIDTH=y/# CONFIG_CFS_BANDWIDTH is not set/' ./.config
@ -334,6 +354,8 @@ _tkg_srcprep() {
if [ "$CONDITION0" = "0" ]; then if [ "$CONDITION0" = "0" ]; then
if [ "${_cpusched}" = "bmq" ] || [ "${_cpusched}" = "pds" ]; 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
elif [ "${_cpusched}" = "upds" ]; then
sed -i -e 's/int sched_yield_type __read_mostly = 1;/int sched_yield_type __read_mostly = 0;/' ./kernel/sched/pds.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
fi fi
@ -342,6 +364,8 @@ _tkg_srcprep() {
elif [ "$CONDITION0" = "2" ]; then elif [ "$CONDITION0" = "2" ]; then
if [ "${_cpusched}" = "bmq" ] || [ "${_cpusched}" = "pds" ]; 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
elif [ "${_cpusched}" = "upds" ]; then
sed -i -e 's/int sched_yield_type __read_mostly = 1;/int sched_yield_type __read_mostly = 2;/' ./kernel/sched/pds.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
fi fi
@ -350,12 +374,16 @@ _tkg_srcprep() {
msg2 "Using default CPU sched yield type (1)" msg2 "Using default CPU sched yield type (1)"
elif [ "${_cpusched}" = "bmq" ] || [ "${_cpusched}" = "pds" ]; 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
elif [ "${_cpusched}" = "upds" ]; then
sed -i -e 's/int sched_yield_type __read_mostly = 1;/int sched_yield_type __read_mostly = 0;/' ./kernel/sched/pds.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
# Round Robin interval # Round Robin interval
if [ "${_cpusched}" = "MuQSS" ] || [ "${_cpusched}" = "pds" ] || [ "${_cpusched}" = "bmq" ]; then if [ "${_cpusched}" = "MuQSS" ] || [ "${_cpusched}" = "pds" ] || [ "${_cpusched}" = "bmq" ] || [ "${_cpusched}" = "upds" ]; then
if [ -n "$_rr_interval" ]; then if [ -n "$_rr_interval" ]; then
CONDITION1="$_rr_interval" CONDITION1="$_rr_interval"
else else
@ -389,6 +417,8 @@ _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}" = "upds" ]; then
sed -i -e "s/#define SCHED_DEFAULT_RR (4)/#define SCHED_DEFAULT_RR (${_rrvalue})/" ./kernel/sched/pds.c
elif [ "${_cpusched}" = "bmq" ] || [ "${_cpusched}" = "pds" ]; then elif [ "${_cpusched}" = "bmq" ] || [ "${_cpusched}" = "pds" ]; 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

@ -0,0 +1,18 @@
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)

@ -0,0 +1,166 @@
From f7f49141a5dbe9c99d78196b58c44307fb2e6be3 Mon Sep 17 00:00:00 2001
From: Tk-Glitch <ti3nou@gmail.com>
Date: Wed, 4 Jul 2018 04:30:08 +0200
Subject: glitched - PDS
diff --git a/kernel/Kconfig.hz b/kernel/Kconfig.hz
index 2a202a846757..1d9c7ed79b11 100644
--- a/kernel/Kconfig.hz
+++ b/kernel/Kconfig.hz
@@ -4,7 +4,7 @@
choice
prompt "Timer frequency"
- default HZ_250
+ default HZ_500
help
Allows the configuration of the timer frequency. It is customary
to have the timer interrupt run at 1000 Hz but 100 Hz may be more
@@ -39,6 +39,13 @@ choice
on SMP and NUMA systems and exactly dividing by both PAL and
NTSC frame rates for video and multimedia work.
+ config HZ_500
+ bool "500 HZ"
+ help
+ 500 Hz is a balanced timer frequency. Provides fast interactivity
+ on desktops with great smoothness without increasing CPU power
+ consumption and sacrificing the battery life on laptops.
+
config HZ_1000
bool "1000 HZ"
help
@@ -52,6 +59,7 @@ config HZ
default 100 if HZ_100
default 250 if HZ_250
default 300 if HZ_300
+ default 500 if HZ_500
default 1000 if HZ_1000
config SCHED_HRTICK
diff --git a/kernel/Kconfig.hz b/kernel/Kconfig.hz
index 2a202a846757..1d9c7ed79b11 100644
--- a/kernel/Kconfig.hz
+++ b/kernel/Kconfig.hz
@@ -4,7 +4,7 @@
choice
prompt "Timer frequency"
- default HZ_500
+ default HZ_750
help
Allows the configuration of the timer frequency. It is customary
to have the timer interrupt run at 1000 Hz but 100 Hz may be more
@@ -46,6 +46,13 @@ choice
on desktops with great smoothness without increasing CPU power
consumption and sacrificing the battery life on laptops.
+ config HZ_750
+ bool "750 HZ"
+ help
+ 750 Hz is a good timer frequency for desktops. Provides fast
+ interactivity with great smoothness without sacrificing too
+ much throughput.
+
config HZ_1000
bool "1000 HZ"
help
@@ -60,6 +67,7 @@ config HZ
default 250 if HZ_250
default 300 if HZ_300
default 500 if HZ_500
+ default 750 if HZ_750
default 1000 if HZ_1000
config SCHED_HRTICK
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 9270a4370d54..30d01e647417 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -159,7 +159,7 @@ struct scan_control {
/*
* From 0 .. 100. Higher means more swappy.
*/
-int vm_swappiness = 60;
+int vm_swappiness = 20;
/*
* The total number of pages which are beyond the high watermark within all
* 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)
{}