Supercharge Your Linux System

This post started out as a repository of tweaks for Arch Linux, although you can apply most of it to any distro. To ensure this post stays relevant, I’ve linked to Arch Wiki sections when possible. AMD-specific optimisations are not covered. Ubuntu-specific optimisations can be found at the end of the post.

I update this post regularly. If you have any suggestions, feel free to mail me!

Basics

Go through the Arch installation guide. If you have an SSD and plan on wiping your drive, do a memory cell clearing to restore factory write speeds. Be careful when selecting the drive, this wipes everything on it. I go with Ext4 for my partitions. Refer to the bytes-per-inode ratio and reserved block sections before creating your Ext4 partition. If you go with Btrfs, enable compression with zstd at level 1 (compress=zstd:1). As for the kernel, use linux-zen. It’s not the best, but it’s better than vanilla. Don’t bother with all those fancy-sounding custom kernels you find out there. Go through the general recommendations. Except for security, because protection is no fun.

Graphics

Set up your GPU drivers. I use EnvyControl to manage NVIDIA Optimus. I keep my dGPU disabled unless I need it for gaming. Go through Intel graphics for Intel. Take a look at GuC/HuC firmware loading and framebuffer compression in particular. I would also suggest turning off GPU mitigations (i915.mitigations=off).

Install appropriate drivers and verify hardware video acceleration. Set appropriate values for LIBVA_DRIVER_NAME and VDPAU_DRIVER by adding export commands to /etc/profile.d/env.sh. Adding them to bashrc won’t work, these environment variables must be set in the login shell.

If you game, install and use gamemode to improve performance. I don’t game anymore, so I don’t keep up with gaming optimisations in particular.

Browser

For Firefox, refer to the hardware acceleration section. Check out touchscreen gestures and pixel-perfect trackpad scrolling. Export them from env.sh.

For Chromium and Chromium-based browsers, refer to the hardware acceleration and force GPU acceleration sections. You can verify it at chrome://gpu. Video decoding information is at the bottom of the page. You can enable touchpad gestures on Chromium too. To enable middle mouse button scrolling, add the following flags: --test-type --enable-blink-features=MiddleClickAutoscroll.

Profile-sync-daemon can help speed up your browser performance by storing your browser profiles in tmpfs. You can also store your browser cache in tmpfs, Arch has instructions for both Firefox and Chromium, although I only use PSD.

Power Management

Now onto power management. I use a script by kerneltoast that enables runtime power management for all devices (except USB). Create /etc/systemd/system/powersave.service with the following contents and enable it by sudo systemctl enable --now powersave.service.

[Unit]
Description=Powersave auto tune
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target

[Service]
Type=oneshot
ExecStart=/usr/bin/bash -c "find /sys -regex '.*?power/control$' ! -path '*usb*' -exec bash -c 'echo on > {}; echo auto > {}' \\;"

[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target
WantedBy=multi-user.target

For CPU frequency scaling, install power-profiles-daemon and enable it. If your CPU doesn’t support hardware P-states (you can check your Intel or AMD CPU), you can use auto-cpufreq instead. Note that Zen kernel disables the intel_pstate driver needed by power-profiles-daemon; pass intel_pstate=enable to the kernel args to enable it. Don’t bother with TLP or other such tools.

Install thermald if you have an Intel CPU.

If possible, undervolt your CPU and GPU. For Intel, you can disable SGX in your BIOS to disable the Plundervolt fixes, which should enable undervolting on newer machines. Don’t be put off by the warning on the Arch Wiki page. I have my CPU undervolted to -150mV and GPU to -100mV. Your mileage will vary. Start at -80mV for the CPU and -50mV for the GPU.

Memory Management

Use zswap with a swapfile or swap partition. zswap compresses pages in RAM and moves the cold ones to your swap on disk. It’s on by default on Arch. Set the compressor to lz4 by adding the zswap.compressor=lz4 kernel parameter. zsmalloc is the default allocator on current kernels, so there’s nothing to change there.

Don’t use zram. It fills up with cold pages and has no way to get rid of them, so your active pages get pushed to disk instead. Chris Down explains it well.

Add the following to /etc/sysctl.d/10-custom.conf:

# zswap makes swapping cheap, so don't lower this.
# The kernel docs suggest going above 100 for zswap:
# https://docs.kernel.org/admin-guide/sysctl/vm.html#swappiness
vm.swappiness = 100

# Watermark boosting can freeze your system under memory pressure:
# https://github.com/kerneltoast/kernel_x86_laptop/commit/ff6d6c4
vm.watermark_boost_factor = 0

# From Pop!_OS: https://github.com/pop-os/default-settings
vm.watermark_scale_factor = 125
vm.dirty_bytes = 268435456
vm.dirty_background_bytes = 134217728

Misc. Tweaks

Linux 7.1 added a new NTFS driver, ntfs. Use it over NTFS3. Install ntfsprogs-plus from the AUR for its userspace utilities. Note that udisks still prefers NTFS3, so set the preferred driver if your file manager mounts your drives.

Other tweaks that I perform:

Ubuntu-Specific Optimisations

Install zlib-ng, the instructions are provided in the link.

Keep the default /swap.img and make sure zswap is on (cat /sys/module/zswap/parameters/enabled). If it says N, add zswap.enabled=1 zswap.compressor=lz4 to your kernel args.

Disable AppArmor by adding apparmor=0 to your kernel args and running sudo systemctl disable --now apparmor.

Liquiorix kernel is the Ubuntu equivalent of Zen on Arch Linux. I use the default kernel. If you want to install it, run the following command:

curl -s 'https://liquorix.net/install-liquorix.sh' | sudo bash

Ubuntu 24.04 added several low-latency tunables to their default kernel, explained in this post. I use the following: preempt=full rcu_nocbs=all rcutree.enable_rcu_lazy=1

Changelog

Note: Changes made before 06 Sep 24 are not covered.

  • 27 Oct 26: Replaced zram with zswap and NTFS3 with the new NTFS driver, added Btrfs compression, sysctl tweaks, and noatime, removed the desktop environment section
  • 06 Sep 24: Improve CPU frequency scaling section