Update README (#128)

* Update README

* Update wording and title

* Lowercase "L" in the title

* Improve writing

* Update user patches section

* Update README.md

Co-authored-by: Koopa <codingkoopa@gmail.com>

* Add 5.11rc as CFS only for now

* Tweaks

* typo

* Move the "other stuff" higher. Users want to see this before user patching support and co

* README: move Zenify as optional feature

* Add more details about the intel_pstate case

* Options refactor

* README: small text tweaks

* README: simplify modprobed-db text

* README: Arch Linux name change

Co-authored-by: Koopa <codingkoopa@gmail.com>

* README: @CodingKoopa fixes

Co-authored-by: Koopa <codingkoopa@gmail.com>

* Tweaks

 - Compiler optimizations don't deserve that much space
 - Simplify the modprobed-db part a bit
 - Link to our own Anbox usage mini-guide

* That turn of phrase hurts me for some reason, sorry Adel

Not sure if it's plainly incorrect english or not (it follows the french logic though, which doesn't usually work that well in english)

* Not sure why I specified LTO here, it affects Clang, with and without LTO

Co-authored-by: Koopa <codingkoopa@gmail.com>
Co-authored-by: Etienne JUVIGNY <ti3nou@gmail.com>
This commit is contained in:
Adel Kara Slimane
2021-06-10 17:13:28 +02:00
committed by GitHub
parent de3193f4a4
commit 82baeebc13

113
README.md
View File

@@ -1,42 +1,54 @@
**Due to intel_pstate poor performances as of late, I have decided to set it to passive mode to make use of the acpi_cpufreq governors passthrough, keeping full support for turbo frequencies.**
## linux-tkg
## Nvidia prop drivers might need to be patched if they aren't supporting your chosen kernel OOTB (https://github.com/Frogging-Family/nvidia-all can do that automatically for you)
This repository provides scripts to automatically download, patch and compile the Linux Kernel from [the official Linux git repository](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git), with a selection of patches aiming for better desktop/gaming experience. The provided patches can be enabled/disabled by editing the `customization.cfg` file and/or by following the interactive install script. You can also use your own patches (more information in `customization.cfg` file).
### Important information
Custom Linux kernels with specific CPU schedulers related patchsets selector (CFS is an option for every kernel) with added tweaks for a nice interactivity/performance balance, aiming for the best gaming experience.
- 5.13 RCs (Project C / PDS & BMQ, CacULE)
- 5.12.y (Project C / PDS & BMQ, MuQSS, CacULE)
- 5.11.y (Undead PDS, Project C / PDS & BMQ, MuQSS)
- 5.10.y (Undead PDS, Project C / PDS & BMQ, MuQSS)
- 5.9.y (Undead PDS, Project C / PDS & BMQ, MuQSS)
- 5.8.y (Undead PDS, Project C / PDS & BMQ)
- 5.7.y (MuQSS, PDS, Project C / BMQ)
- 5.4.y (MuQSS, PDS, BMQ)
- In `intel_pstate` driver, frequency scaling aggressiveness has been changed with kernel 5.5 which results in stutters and poor performance in low/medium load scenarios (for higher power savings). As a workaround for our gaming needs, we are setting it to passive mode to make use of the `acpi_cpufreq` governor passthrough, keeping full support for turbo frequencies. It's combined with our aggressive ondemand governor by default for good performance on most CPUs while keeping frequency scaling for power savings. In a typical low/medium load scenario (Core i7 9700k, playing Mario Galaxy on Dolphin emulator) intel_pstate in performance mode gives a stuttery 45-50 fps experience, while passive mode + aggressive ondemand offers a locked 60 fps.
- Nvidia's proprietary drivers might need to be patched if they don't support your chosen kernel OOTB: [Frogging-Family nvidia-all](https://github.com/Frogging-Family/nvidia-all) can do that automatically for you.
- Note regarding kernels older than 5.9 on Arch Linux: since the switch to `zstd` compressed `initramfs` by default, you will face an `invalid magic at start of compress` error by default. You can workaround the issue by editing `/etc/mkinitcpio.conf` to uncomment the `COMPRESSION="lz4"` (for example, since that's the best option after zstd) line and regenerating `initramfs` for all kernels with `sudo mkinitpcio -P`
CacULE : https://github.com/hamadmarri/cacule-cpu-scheduler
### Customization options
#### Alternative CPU schedulers
MuQSS : http://ck-hack.blogspot.com/
[CFS](https://en.wikipedia.org/wiki/Completely_Fair_Scheduler) is the only CPU scheduler available in the "vanilla" kernel sources. Its current implementation doesn't allow for injecting additional schedulers, and requires replacing it. Only one scheduler can be patched in at a time.
Project C / PDS & BMQ : http://cchalpha.blogspot.com/
Alternative schedulers are available to you in linux-tkg:
- Project C / PDS & BMQ by Alfred Chen: [blog](http://cchalpha.blogspot.com/ ), [code repository](https://gitlab.com/alfredchen/projectc)
- MuQSS by Con Kolivas : [blog](http://ck-hack.blogspot.com/), [code repository](https://github.com/ckolivas/linux)
- CacULE by Hamad Marri: [code repository](https://github.com/hamadmarri/cacule-cpu-scheduler)
- Undead PDS: TkG's port of the pre-Project C "PDS-mq" scheduler by Alfred Chen. While PDS-mq got dropped with kernel 5.1 in favor of its BMQ evolution/rework, it wasn't on par with PDS-mq in gaming. "U" PDS still performs better in some cases than other schedulers, so it's been kept undead.
Undead PDS: PDS-mq was originally created by Alfred Chen : http://cchalpha.blogspot.com/
These alternative schedulers can offer a better performance/latency ratio for gaming and desktop use. The availability of each scheduler depends on the chosen Kernel version: the script will display what's available on a per-version basis.
#### Default tweaks
- Memory management and swapping tweaks
- Scheduling tweaks
- `CFS` tweaks
- Using the ["Cake"](https://www.bufferbloat.net/projects/codel/wiki/CakeTechnical/) network queue management system
- Using `vm.max_map_count=524288` by default
- Cherry-picked patches from [Clear Linux's patchset](https://github.com/clearlinux-pkgs/linux)
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.
Update: Alfred has revived PDS through Project C as of kernel 5.8.0 release.
#### Optional tweaks
The `customization.cfg` file offers many toggles for extra tweaks:
- `Fsync`, `Futex2` and `Fastsync+winesync` support: can improve the performance in games, needs a patched wine like [wine-tkg](https://github.com/Frogging-Family/wine-tkg-git)
- [Graysky's per-CPU-arch native optimizations](https://github.com/graysky2/kernel_compiler_patch): tunes the compiled code to to a specified CPU
- Compile with GCC or Clang with optional `O2`/`O3` and `LTO` (Clang only) optimizations.
- **Warning regarding DKMS modules and Clang:** `DKMS` will default to using GCC, which will fail to build modules against a Clang-built kernel. This will - for example - break Nvidia drivers. Forcing `DKMS` to use Clang can be done but isn't recommended.
- Using [Modprobed-db](https://github.com/graysky2/modprobed-db)'s database can reduce the compilation time and produce a smaller kernel which will only contain the modules listed in it. **NOT recommended**
- **Warning**: make sure to read [thoroughly about it first]((https://wiki.archlinux.org/index.php/Modprobed-db)) since it comes with caveats that can lead to an unbootable kernel.
- "Zenify" patchset using core blk, mm and scheduler tweaks from Zen
- [Anbox](https://wiki.archlinux.org/title/Anbox) support (See [Anbox usage](https://github.com/Frogging-Family/linux-tkg#anbox-usage))
- `ZFS` FPU symbols (<5.9)
- Overrides for missing ACS capabilities
- Provide own kernel `.config` file
- ...
#### User patches
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.
To apply your own patch files using the provided scripts, you will need to put them in a `linux5y-tkg-userpatches` folder -- `y` needs to be changed with the kernel version the patch works on, _e.g_ `linux510-tkg-userpatches` -- at the same level as the `PKGBUILD` file, with the `.mypatch` extension. The script will by default ask if you want to apply them, one by one. The option `_user_patches` should be set to `true` in the `customization.cfg` file for this to work.
Comes with a slightly modified Arch config asking for a few core personalization settings at compilation time.
If you want to streamline your kernel config for lower footprint and faster compilations : https://wiki.archlinux.org/index.php/Modprobed-db
You can optionally enable support for it at the beginning of the PKGBUILD file. **Make sure to read everything you need to know about it as there are big caveats making it NOT recommended for most users**.
#### Anbox usage
**Note regarding kernels older than 5.9 on Archlinux:**
**Since the switch to zstd compressed initramfs by default, you will face an "invalid magic at start of compress" error by default. You can workaround the issue by editing `/etc/mkinitcpio.conf` to uncomment the `COMPRESSION="lz4"` (for example, since that's the best option after zstd) line and regenerating for all kernels with `sudo mkinitpcio -P`.**
### Anbox usage
When enabling the anbox support option, the modules are built-in. You don't have to load them. However you'll need to mount binderfs :
When enabling the anbox support option, the `binder` and `ashmem` modules are built-in. You don't have to load them. However you'll need to mount binderfs :
```
sudo mkdir /dev/binderfs
sudo mount -t binder binder /dev/binderfs
@@ -64,47 +76,36 @@ systemctl enable anbox-container-manager.service
You're set to run Anbox.
## Other stuff included:
- Graysky's per-CPU-arch native optimizations - https://github.com/graysky2/kernel_compiler_patch
- memory management and swapping tweaks
- scheduling tweaks
- optional "Zenify" patchset using core blk, mm and scheduler tweaks from Zen
- CFS tweaks
- using yeah TCP congestion algo by default
- using cake network queue management system
- using vm.max_map_count=524288 by default
- cherry-picked clear linux patches
- **optional** overrides for missing ACS capabilities
- **optional** Fsync support (proton)
- **optional** futex2 support (proton)
- **optional** Anbox support (binder, ashmem)
- **optional** ZFS fpu symbols (<5.9)
## Install procedure
### Install procedure
### Arch & derivatives
#### Arch & derivatives
```
git clone https://github.com/Frogging-Family/linux-tkg.git
cd linux-tkg
# Optional: edit customization.cfg file
# Optional: edit the "customization.cfg" file
makepkg -si
```
The script will use a slightly modified Arch config from the `linux-tkg-config` folder. The options selected at build-time are installed to `/usr/share/doc/$pkgbase/customization.cfg`, where `$pkgbase` is the package name.
### DEB (Debian, Ubuntu and derivatives) and RPM (Fedora, SUSE and derivatives) based distributions
#### DEB (Debian, Ubuntu and derivatives) and RPM (Fedora, SUSE and derivatives) based distributions
```
git clone https://github.com/Frogging-Family/linux-tkg.git
cd linux-tkg
# Optional: edit customization.cfg file
# Optional: edit the "customization.cfg" file
./install.sh install
```
Uninstalling custom kernels installed through the script has to be done
Uninstalling custom kernels installed through the script has to be done
manually. The script can can help out with some useful information:
```
cd path/to/linux-tkg
./install.sh uninstall-help
```
The script will use your current kernel's `.config` file, which will be searched for either at ``/boot/config-`uname -r`.config`` or ``/proc/config.gz`` (otherwise the script won't work as-is). It's recommended to run the script booted on your distro-provided kernel.
### Void Linux
#### Void Linux
```
git clone -b tkg https://github.com/Hyper-KVM/void-packages/
cd void-packages
@@ -115,15 +116,16 @@ cd void-packages
```
If you have to restart the build for any reason, run `./xbps-src clean linux-tkg` first.
### Other linux distributions
If your distro is not DEB or RPM based, `install.sh` script can clone the kernel tree in the `linux-src-git` folder, patch and edit a `.config` file from the one that your current distro uses. It is expected either at ``/boot/config-`uname -r`.config`` or ``/proc/config.gz`` (otherwise it won't work as-is).
#### Other linux distributions
If your distro is neither DEB nor RPM based, `install.sh` script can clone the kernel tree in the `linux-src-git` folder, patch and edit a `.config` file based on your current kernel's. It's expected either at ``/boot/config-`uname -r`.config`` or ``/proc/config.gz`` (otherwise it won't work as-is).
The command to do for that is:
To do so, run:
```
# Optional: edit the "customization.cfg" file
./install.sh config
```
If one chooses `Generic` as distro. `./install.sh install` will compile the kernel then prompt before doing the following:
When selecting `Generic` as distro, `./install.sh install` will compile the kernel then prompt before doing the following:
```shell
sudo make modules_install
sudo make headers_install INSTALL_HDR_PATH=/usr # CAUTION: this will replace files in /usr/include
@@ -131,5 +133,4 @@ sudo make install
sudo dracut --force --hostonly --kver $_kernelname
sudo grub-mkconfig -o /boot/grub/grub.cfg
```
**Note:** these changes will not be tracked by your package manager and uninstalling requires manual intervention.
**Note:** these changes will not be tracked by your package manager and uninstalling requires manual intervention. `./install.sh uninstall-help` can help with useful information if your install procedure follows the `Generic` approach.