Editing mkinitcpio.conf for faster boot times
Replace udev with systemd for faster boots and set compression algorithm to zstd and compression level to 2 because compression ratio increase isn’t worth the increased boot time.
(bellow isnt the whole file, just the parts that needs changes)
Note: You can replace base AND udev with systemd but you will lose access to recovery shell.
Changing io schedulers
The process to change I/O scheduler, depending on whether the disk is rotating or not can be automated and persist across reboots. For example the udev rule below sets the scheduler to none for NVMe, mq-deadline for SSD/eMMC, and bfq for rotational drives:
Editing /etc/makepkg.conf (in Arch linux or derivatives)
Edit makepkg config file for it to utilize all threads on your cpu Example for 12 threads:
Auto nice daemons and irq balance
Ananicy-cpp can be installed to automatically set nice levels.
Irq balance distributes hardware interrupts across available processors to improve system performance.
Zram or Zswap
Zswap is a kernel feature that provides a compressed RAM cache for swap pages. Pages which would otherwise be swapped out to disk are instead compressed and stored into a memory pool in RAM. Once the pool is full or the RAM is exhausted, the least recently used (LRU) page is decompressed and written to disk, as if it had not been intercepted. After the page has been decompressed into the swap cache, the compressed version in the pool can be freed.
The difference compared to ZRAM is that zswap works in conjunction with a swap device while zram is a swap device in RAM that does not require a backing swap device.
Since it is enabled by default, disable zswap when you use zram to avoid it acting as a swap cache in front of zram. Having both enabled also results in incorrect zramctl statistics as zram remains mostly unused; this is because zswap intercepts and compresses memory pages being swapped out before they can reach zram.
Recommended configurations for zswap
Above will change zswap settings only for current session, to make the setting changes persist add zswap.compressor=lz4 zswap.max_pool_percent=10
to your bootloader’s config file for the kernel command line.
/etc/sysctl.d/99-swap-tune.conf:
for ssd:
for hdd:
Recommended configurations for zram
/etc/systemd/zram-generator.conf:
Above config file is for systemd zram generator
You can increase zram-size
further if you find compression ratio to be high enough.
/etc/sysctl.d/99-swap-tune.conf:
A more detailed explanation can about why these values were chosen can be found in Zram.
Transparent Huge Pages
To summarize, transparent hugepages are a framework within the Linux kernel that allows it to automatically facilitate and allocate large memory page block sizes to processes (such as games) with sizes averaging around 2 MB per page and occasionally 1 GB (the kernel will automatically adjust the size to what the process needs).
There are 3 values you can choose You should try each value yourself to see if it improves your workflow, for more information click here: Transparent Huge Pages. To change the value for current session:
To make changes persist:
Install sysfsutils and then add kernel/mm/transparent hugepage/enabled=always
to /etc/sysfs.conf
or add transparent_hugepage=always
to your bootloader’s config file for the kernel command line.
Additional sources
initramfs
https://wiki.archlinux.org/title/Mkinitcpio/Minimal_initramfs
Zram
https://docs.kernel.org/admin-guide/sysctl/vm.html
https://www.reddit.com/r/Fedora/comments/mzun99/new_zram_tuning_benchmarks/
Transparent Huge Pages
https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html
https://access.redhat.com/solutions/46111
https://www.reddit.com/r/linux_gaming/comments/uhfjyt/underrated_advice_for_improving_gaming/