项目作者: jiblime

项目描述 :
Patchsets for applying to bare kernels for the Gentoo GNU/Linux distribution.
高级语言: Shell
项目地址: git://github.com/jiblime/clear-ck-gentoo-sources.git
创建时间: 2019-08-26T03:20:05Z
项目社区:https://github.com/jiblime/clear-ck-gentoo-sources

开源协议:GNU General Public License v2.0

下载


Preface: This is a collection of patchsets for applying to bare GNU/Linux kernels for the Gentoo GNU/Linux distribution. These patchsets are meant to be applied to a vanilla Linux kernel with no sublevel. Using dev-util/quilt is recommended to handle patching.

clearly-faster-gentoo-sources-ck1

The intention of this project is to streamline the process of using the patching system to harden/optimize the Linux kernel for Gentoo, primarily with the MuQSS patchset, Clear Linux patches, and Gentoo’s genpatches for the x86-64 architecture. An emphasis is placed on the current stable kernel to follow ongoing development.


Currently included in the patchsets:

1. Con Kolivas’ MuQSS patchset, which includes his scheduler as well as modifications to the kernel. MuQSS was designed with the idea that the end user should not have to deal with multiple tunables to achieve smooth desktop usage.

2. Clear Linux’s distribution by Intel has pushes patches for their own distro kernel as well to mainline kernel development. There are patches to increase general performance, CVE hotfixes, and distro specific patches in the repository. The script in this repo will create a concatenated patch of all the Clear Linux patches. excluding patches made only for the Clear Linux distribution, are not AMD/Intel agnostic, or reduce performance in return for security. If it were important enough, I would hope that it’d be accepted upstream anyway. Note that the patch generator script may reference an older version by x.x.1 but that’s fine.

3. Genpatches for Gentoo is maintained by Tom Wijsman and Mike Pagano and a single hand sometimes. I’ve included the experimental and distro specific patches that give the config some more knobs to spin. Note: these knobs are defaulted to making the .config making process easier by selecting what is generally needed to have a bootable kernel. What is included depends on the major kernel version but hasn’t changed recently. Do note that the distro-specific patches do not cause incompatibility with other distributions.

4. Graysky2’s Kernel_gcc_patch is actually already in Gentoo’s experimental patches, but graysky2 has updated his patch for GCC 9 and the options now include newer CPUs. Generating code optimized for your processor is a guaranteed performance boost. Because this newest patch is meant for GCC >9.1 and a kernel version that is >4.13, you may be interested in using his older patches instead if you currently don’t have the newest GCC available. graysky2’s GitHub homepage is located at below.

5. ocerman’s zenpower module is an in kernel module now so there will be no need to sign it or rebuild it after creating a new kernel.

/6/7/etc. Random patches I’ve piled in to test. Read the heads of each patch to get a URL to patch source and some information. The (now) unmaintainted it87.c replacement is still much further ahead in development than the in-kernel version.


Con Kolivas’ website/MuQSS details

  1. http://ck-hack.blogspot.com/
  2. http://ck.kolivas.org/patches/muqss/sched-MuQSS.txt
  3. Tunables:
  4. [1-1000] /proc/sys/kernel/rr_interval
  5. [0-1] /proc/sys/kernel/interactive
  6. [0-100] /proc/sys/kernel/iso_cpu

Clear Linux pkgs repo for the Linux kernel

  1. https://github.com/clearlinux-pkgs/linux

Gentoo’s official Genpatches maintainers homepage

  1. https://dev.gentoo.org/~mpagano/genpatches/

graysky2’s architecture optimization patches

  1. https://github.com/graysky2/kernel_gcc_patch

ocerman’s zenpower (and zenmonitor)

  1. https://github.com/ocerman/zenpower
  2. https://github.com/ocerman/zenmonitor

Examples of different ways to attain the two-point release kernel:

wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.3.tar.xz

git clone --branch v5.3 https://github.com/torvalds/linux.git linux-5.3-ck1

git clone https://github.com/torvalds/linux.git linux-git ; cd linux-git ; git checkout v5.3

Bare 5.2.0 Linux kernel

Bare 5.3.0 Linux kernel

Notes:

  • Within the clear patch generator script are reasons as to why a patch is excluded.

  • Enable the appropriate debugging modules if you face an issue you didn’t experience prior to this kernel. The only time I’ve experienced severe stuttering was when I enabled compulsory IRQ threading.

  • MuQSS’s recommended settings:
    CONFIG_HZ_100=Y: Read the section under Tickless expiry:

  • CONFIG_RQ_MC=Y: Best for those who are interested in low latency, but the other runqueues have their uses

  • Note: 5.3 has introduced CONFIG_RQ_MC_LLC for CPUs with multiple last level caches which many new processors have; worth testing!

  • CONFIG_FORCE_IRQ_THREADING is not set: This is only needed for those who are unable to boot when CONFIG_FORCE_IRQ_THREADING=Y, and is off by default.

Gentoo Example Installation (WIP)

  1. # Run all these commands as root
  2. emerge -avu quilt dev-vcs/git # Optionally run `perl-cleaner --really-all` afterwards if Perl was upgraded
  3. wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.3.tar.xz
  4. xz -df linux-5.3.tar.xz && tar xpf linux-5.3.tar && rm linux-5.3.tar
  5. mv linux-5.3 linux-5.3-ck1
  6. eselect kernel set linux-5.3-ck1
  7. cd /usr/src/linux
  8. git clone --recurse-submodules https://github.com/jiblime/clear-ck-gentoo-sources.git patches && cd patches
  9. -or-
  10. git clone https://github.com/jiblime/clear-ck-gentoo-sources.git patches && cd patches
  11. git submodule update --init
  12. To checkout the latest tag for a submodule instead of a random branch:
  13. cd submodules/clear
  14. git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
  15. And the same for submodules/zenpower
  16. ./patch-generator.sh
  17. # Below is a simple script to get your current .config into the directory quickly if you need one provided.
  18. # It first checks /proc/config.gz then /boot. All you need to do is copy/paste it into terminal.
  19. # Both have interactive mode on, just in case you might overwrite an existing .config.
  20. if [ -r /proc/config.gz ]; then
  21. zcat /proc/config.gz > /tmp/.config && mv -iv /tmp/.config /usr/src/linux ;
  22. elif
  23. echo $?
  24. [[ -r /boot/config-`uname -r` ]]; then
  25. cp -iv /boot/config-`uname -r` /usr/src/linux/.config
  26. echo mv -iv /tmp/.config /usr/src/linux ;
  27. fi
  28. # You'll still need to update the config. `make oldconfig` works. Run `make help` to view more options.
  29. make oldconfig
  30. ###
  31. # Below is a generic kernel installation using dracut to create a separate initrd that compiles in tmpfs to save...seconds?
  32. #!/bin/bash
  33. mkdir /tmp/fslinux
  34. mount --rbind /usr/src/linux /tmp/fslinux -v
  35. cd /tmp/fslinux
  36. make clean
  37. make -j$(cat /proc/cpuinfo | grep processor | wc -l) && cd /usr/src/linux &&
  38. make modules_install install -j$(cat /proc/cpuinfo | grep processor | wc -l) &&
  39. emerge @module-rebuild
  40. dracut --kver $(file /usr/src/linux/arch/x86/boot/bzImage | sed 's/^.*version\ //g ; s/\ .*//g') --xz --fstab
  41. grub-mkconfig -o /boot/grub/grub.cfg