Linux Kernel & System Performance Tweaks for Gaming: The Ultimate Unsafe Guide

Want smoother gameplay on Linux in minutes? These six tweaks from CPU governor and GRUB parameters to SSD scheduler and GPU power mode, can reduce frame-time variance by up to 15%, making games feel faster, more stable, and more responsive.

Linux Kernel & System Performance Tweaks for Gaming: The Ultimate Unsafe Guide

Below is a single‑page cheat‑sheet that gathers every kernel‑level knob that people normally touch when they want raw performance – especially for games – and are willing to sacrifice security, stability and power‑saving.

For each item, you will find

# Parameter / setting Where it lives What it does (short) “Performance” value How to enable it How to revert it
How to read this documentMost of the entries are sysctl variables (/etc/sysctl.conf or a file under /etc/sysctl.d/). They can be applied instantly with sysctl -w … and made permanent by adding the line to a file that is loaded at boot.Some entries are kernel boot parameters – they belong on the GRUB_CMDLINE_LINUX_DEFAULT= line in /etc/default/grub and require a update‑grub + reboot.A few are userspace utilities (cpupower, tuned, systemd‑run, irqbalance, …) – they are started/stopped with systemctl.Reverting is simply the opposite: delete the line (or comment it), run sysctl -p (or sysctl -w for the temporary change) and/or rebuild the grub config and reboot.

1. CPU / Scheduler

# Parameter Location What it does Performance value How to enable How to revert
1 CPU governor userspace (cpupower,
tuned)
Controls frequency scaling.
performance
locks the CPU at the highest frequency.
performance (or schedutil
with max_perf_pct=100)
sudo cpupower
frequency-set -g performance

(or enable tuned profile
tuned-adm profile
latency-performance
)
sudo cpupower
frequency-set -g
powersave
2 Disable C‑states kernel boot param Prevents deep sleep
states that add latency
when the core wakes.
intel_idle.max_cstate=1
(or 0 on older kernels)
Add to GRUB:
intel_idle.max_cstate=1
Remove from GRUB
3 Disable Turbo Boost
(optional)
kernel boot param or
msr
Some games run more
predictably at the rated
base clock.
nohz_full=1, nosmt or
intel_pstate=disable
+ max_perf_pct=100
intel_pstate=disable
max_perf_pct=100
Remove the parameters
4 Isolate the cores
used by the game
kernel boot param +
cset
Moves the game to
“isolated” CPUs that are
not used by the scheduler
for background tasks.
isolcpus=2,3
(pick two cores)
Add isolcpus=2,3 to GRUB,
then launch the game with
cset shield --cpu 2,3
--exec ./gamebinary
Remove isolcpus from GRUB
5 Disable SMT/Hyper‑Threading kernel boot param Removes logical siblings,
reduces contention.
nosmt (Intel) /
noht (AMD)
Add nosmt (or noht)
to GRUB
Remove
6 Scheduler latency tunables /etc/sysctl.conf
(kernel.sched_*)
Tweaks the Completely
Fair Scheduler (CFS) for
low‑latency workloads.
kernel.
sched_min_granularity_ns
= 1000000

kernel.
sched_wakeup_granularity_ns
= 1500000

kernel.
sched_child_runs_first
= 0
sysctl -w
kernel.
sched_min_granularity_ns
=1000000
Restore defaults
(1ms and 5ms
respectively) or delete
the lines
7 Prefer real‑time priority
for the game
userspace (chrt) Gives the game
SCHED_FIFO/RR priority.
chrt -f 99 ./gamebinary Run the launcher with
sudo chrt -f 99 …
Use normal priority
(chrt -r 0 …
or just launch normally)

2. Memory / VM

# Parameter Location What it does Performance value How to enable How to revert
1 Swappiness /etc/sysctl.conf Controls how aggressively Linux swaps. 0 (never swap) sysctl -w
vm.swappiness
=0
sysctl -w
vm.swappiness
=60

(default)
2 Cache pressure /etc/sysctl.conf Low value keeps file‑system
cache longer.
50 sysctl -w
vm.vfs_cache_pressure
=50
100 (default)
3 Dirty page thresholds /etc/sysctl.conf Determines when dirty pages
are flushed to disk.
vm.dirty_
ratio=5

vm.dirty_
background_ratio=2
sysctl -w
vm.dirty_ratio=5
vm.dirty_ratio=20
vm.dirty_background
_ratio=10
4 Transparent HugePages (THP) /sys/kernel/mm/
transparent_hugepage/
enabled
Uses 2 MiB pages for
anonymous memory
→ less TLB misses.
always echo always >
/sys/kernel/mm/
transparent_hugepage/
enabled

(or add
transparent_hugepage
=always

kernel param)
echo madvise > …
5 Explicit HugePages for the game /proc/sys/vm/
nr_hugepages
Pre‑allocates a pool of 2 MiB pages
that the game can mmap.
nr_hugepages
= 1024

(≈2 GiB)
sysctl -w
vm.nr_hugepages=1024
Set back to 0
6 NUMA balancing kernel boot param Disables automatic page migration
across NUMA nodes – avoids
latency spikes.
numa_balancing
=0
Add to GRUB Remove
7 Overcommit handling /etc/sysctl.conf Allows allocating more memory
than physically present
(useful for some anti‑cheat drivers).
vm.overcommit
_memory=1
sysctl -w
vm.overcommit_memory=1
0 (default)
8 Disable ASLR
(address space
layout randomization)
kernel boot param Gives predictable memory
layout (helps some
games that use
static offsets).
randomize_va
_space=0

(sysctl) or nokaslr boot flag
sysctl -w
kernel.
randomize_va_space=0

or add
nokaslr
to GRUB
Restore to 2

(full randomization)
9 Disable Kernel
Samepage Merging (KSM)
/sys/kernel/
mm/ksm/run
KSM can introduce
latency when it
merges pages.
0 (off) echo 0 >
/sys/kernel/
mm/ksm/run
echo 1 > …
10 Zswap / Zram (optional) kernel boot param
(zswap.enabled=1)
or modprobe zram
Provides compressed swap
in RAM; may improve
low‑memory scenarios
but adds CPU overhead.
Usually off
for pure performance
zswap.enabled=0
(or don’t load the module)
zswap.enabled=1

3. I/O / Disk

# Parameter Location What it does Performance value How to enable How to revert
1 I/O scheduler kernel boot param
(elevator=)
or per‑block‑device via
/sys/block/<dev
>/queue/scheduler
none (no scheduler)
or mq-deadline
gives the lowest
latency on NVMe/SSD.
none
(or mq-deadline
for older kernels)
Add elevator=none
to GRUB or echo none >
/sys/block/sda/
queue/scheduler
echo mq-deadline
> …
(default)
2 NR requests / queue depth /sys/block/<
dev>/queue/nr_requests
Larger queue can improve
throughput but adds
latency; set to a modest
value for
latency‑critical gaming.
64 (instead of 128‑256) echo 64 >
/sys/block/sda/
queue/nr_requests
echo 128 > …
3 Read‑ahead /sys/block/<
dev>/queue/
read_ahead_kb
Reduce prefetch size to avoid pulling in unnecessary data. 128
(default 256‑512)
echo 128 >
/sys/block/sda/queue/
read_ahead_kb
echo 256 >
4 Disable journal on the game’s mount /etc/fstab If you keep the game on a dedicated ext4 partition, mount with nojournal
to avoid extra writes.
nojournal Edit fstab:
UUID=… /games ext4
defaults,noatime,
nojournal 0 2
Remove
nojournal
5 Enable noatime (global) /etc/fstab Prevents updating file access timestamps – fewer writes. noatime (or relatime if you need it) Add noatime to all mount options Remove or change to relatime
6 NVMe power management /sys/class/nvme/
nvme*/power_state
Set the device to
the highest performance state.
0 (max performance) echo 0 >
/sys/class/nvme/
nvme0/power_state
echo 1 >

(or whatever your default)
7 SSD TRIM (keep enabled) No change needed,
but make sure it’s on.
Guarantees sustained
write performance.
discard
mount option or periodic
fstrim
Add discard
to fstab or enable
fstrim.timer
Remove discard

4. Network (for online games / Steam)

# Parameter Location What it does Performance value How to enable How to revert
1 TCP congestion control /etc/sysctl.conf bbr gives lower latency on high‑speed links. net.ipv4.tcp_
congestion_control
= bbr
sysctl -w
net.ipv4.tcp_congestion
_control=bbr
(load tcp_bbr module)
cubic (default)
2 Increase socket buffers /etc/sysctl.conf Prevents drops when bursts of packets arrive. net.core.rmem_max
= 2500000

net.core.wmem_max
= 2500000

net.core.rmem_default = 1250000
net.core.wmem
_default = 1250000
sysctl -w
net.core.rmem_max
=2500000
Restore to
212992
(default)
3 Disable TCP timestamps /etc/sysctl.conf Saves a few µs per packet. net.ipv4.tcp
_timestamps = 0
sysctl -w
net.ipv4.tcp
_timestamps=0
1
4 Turn off ECN (Explicit Congestion Notification) /etc/sysctl.conf Some routers mishandle ECN and add latency. net.ipv4.
tcp_ecn = 0
sysctl -w
net.ipv4.tcp_ecn=0
1
29 IRQ affinity for NIC /proc/irq/*/smp_affinity Pin the NIC’s interrupt to the same core that runs the game. e.g.,
echo 4 >
/proc/irq/45/
smp_affinity

(core 2)
Identify IRQ
(cat /proc/interrupts)
and write a bitmask
Set back to ff (all CPUs)

5. Security / Mitigations (the “big‑hammer” knobs)

# Parameter Location What it does Performance value How to enable How to revert
1 Disable all Spectre / Meltdown mitigations kernel boot param Removes the extra kernel checks that add a few % latency on every system call. mitigations=off
(or
spectre_v2=off
nopti
nospectre_v1

etc.)
Add mitigations=off
to GRUB. For fine‑grained control:
spectre_v2=off,
nospectre_v1,
noibrs,
noibpb,
nopti,
tsx=off
Remove the flags.
2 Disable Kernel Page‑Table Isolation (KPTI) boot param Same as nopti. nopti Add to GRUB Remove
3 Disable retpoline / indirect‑branch speculation boot param retpoline=off
removes the extra indirect‑branch barrier.
retpoline=off Add to GRUB Remove
4 Disable L1TF, MDS, TAA mitigations boot param These mitigations add micro‑code stalls. l1tf=off
mds=off
taa=off
Add to GRUB Remove
5 Disable SELinux / AppArmor userspace Turning off MAC frameworks removes extra file‑access checks. selinux=0
(or set to permissive)
/ apparmor=0
setenforce 0
(temporarily) and edit
/etc/selinux/config
SELINUX=permissive ;
for AppArmor:
systemctl stop apparmor
&&
systemctl disable apparmor
Re‑enable services, set
SELINUX=enforcing
6 Disable ExecShield / PaX kernel boot param nospectre_v2
also disables some
exec‑shield features.
nospectre_v2 Add to GRUB Remove
7 Enable “noexec=off”
on /tmp

(if you keep games unpacked there)
/etc/fstab Allows executing code
from temporary directories.
Remove noexec flag Edit fstab entry for
/tmp
and delete
noexec
Add it back
8 Disable ptrace restrictions sysctl Allows debugging/cheat‑engine type tools that may be needed for some games. kernel.yama.
ptrace_scope = 0
sysctl -w kernel.
yama.ptrace_scope=0
1 (default)

6. GPU‑specific kernel tweaks

# Parameter Location What it does Performance value How to enable How to revert
1 NVIDIA – Disable Power Management /etc/modprobe.d/
nvidia.conf
Prevents the driver from throttling the GPU. options nvidia
NVreg_RegistryDwords
="PowerMizerEnable=0x0"
Create
/etc/modprobe.d/
nvidia.conf

with that line, then
modprobe -r
nvidia &&
modprobe nvidia

(or reboot)
Remove the file or comment the line
2 NVIDIA – Enable “Coolbits” for overclock /etc/modprobe.d
/nvidia.conf
Gives
nvidia-settings
the ability to change clocks.
options nvidia
NVreg_RegistryDwords=
"EnableCoolbits=28"
Add to the same file as above, reload driver Remove the line
3 AMD – Force high performance power profile /sys/class/drm/card0
/device/
power_dpm_state
performance
disables power‑saving states.
echo performance > … echo performance >
/sys/class/drm/card0
/device/power_dpm_state

(or add a udev rule)
echo balanced > …
4 AMD – Enable large‑page GPU memory /sys/class/drm/card0/
device/pp_sclk_od

etc.
Tweaks clock offsets; not a kernel knob per se but done via sysfs. Set to max allowed echo 10 >
/sys/class/drm/card0/
device/pp_sclk_od
Set back to 0
5 Vulkan – Disable validation layers userspace (environment) Saves CPU cycles when
launching Vulkan games.
VK_INSTANCE_LAYERS=
(empty)
export
VK_INSTANCE_LAYERS=

before launching,
or edit
/etc/environment
Remove the variable

7. Miscellaneous “system‑wide” knobs

# Parameter Location What it does Performance value How to enable How to revert
1 Disable
irqbalance
systemd service Prevents the daemon
from moving IRQs around,
which can cause
latency spikes.
systemctl stop
irqbalance
&& systemctl
disable irqbalance
As shown systemctl enable
irqbalance &&
systemctl start
irqbalance
2 Enable
perf
CPU
performance
events
kernel config
(usually built‑in)
Allows using
perf
to verify bottlenecks
– not a performance boost
but a diagnostic tool.
Ensure
CONFIG_PERF_EVENTS=y
Usually already there;
if not, rebuild kernel.
N/A
3 Increase
fs.file-max
/etc/sysctl.conf Allows a larger
number of open
files – useful when
many assets are
opened simultaneously.
fs.file-max =
2097152
sysctl -w
fs.file-max=
2097152
fs.file-max = 8192
(default)
4 Increase
fs.inotify.
max_user_watches
/etc/sysctl.conf Some game launchers
watch many files.
fs.inotify.
max_user_watche
s = 524288
sysctl -w
fs.inotify.
max_user_watches=
524288
8192
5 Set

ulimit -n

(open files)
higher
shell startup
(~/.bashrc)
Mirrors the above for the user session. ulimit -n
1048576
Add line to
.bashrc
Remove or set back to
1024
6 Disable
coredump
/etc/systemd/
coredump.conf
Saves disk I/O when a crash occurs (rare in games). Storage=none Edit file, set
Storage=none
, then
systemctl restart
systemd-coredump
Set back to
journal
or
external
7 Turn off
sysrq
/proc/sys/
kernel/sysrq
Prevents accidental
kernel panic via
key combos
(tiny latency benefit).
echo 0 >
/proc/sys/
kernel/sysrq
sysctl -w
kernel.sysrq=0
1
8 Disable
swap
completely
/etc/fstab
+
swapoff -a
Guarantees zero‑latency memory accesses. Comment out swap line, run
swapoff -a
Edit fstab, comment swap line,
swapoff -a
Re‑enable swap entry,
swapon -a

📦 How to apply all of the above in one go

Below is a copy‑paste ready script that assumes you are using a Debian‑/Ubuntu‑style system with grub, systemd, and the cpupower utility installed. Adjust the device names (sda, nvme0n1, card0, etc.) to match your hardware before running.

#!/usr/bin/env bash
set -e

# -----------------------------------------------------------------
# 1.  Kernel boot parameters (GRUB)
# -----------------------------------------------------------------
GRUB_CONF="/etc/default/grub"

# Add the parameters (append if already there)
NEW_PARAMS="intel_idle.max_cstate=1 nosmt nohz_full=1 mitigations=off \
nopti spectre_v2=off nospectre_v1 retpoline=off l1tf=off mds=off \
taa=off randomize_va_space=0 nokaslr nosmt isolcpus=2,3 \
elevator=none"

# Ensure we don't duplicate entries
if ! grep -q "$NEW_PARAMS" "$GRUB_CONF"; then
    sudo sed -i "s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/& $NEW_PARAMS/" "$GRUB_CONF"
    echo "✔ Added kernel boot params to $GRUB_CONF"
fi

# -----------------------------------------------------------------
# 2.  Sysctl tunables (persistent)
# -----------------------------------------------------------------
SYSCTL_FILE="/etc/sysctl.d/99-gaming-performance.conf"
cat <<'EOF' | sudo tee "$SYSCTL_FILE"
# ---- CPU / Scheduler -------------------------------------------------
kernel.sched_min_granularity_ns = 1000000
kernel.sched_wakeup_granularity_ns = 1500000
kernel.sched_child_runs_first = 0

# ---- Memory ---------------------------------------------------------
vm.swappiness = 0
vm.vfs_cache_pressure = 50
vm.dirty_ratio = 5
vm.dirty_background_ratio = 2
vm.overcommit_memory = 1
vm.nr_hugepages = 1024
vm.max_map_count = 262144
kernel.randomize_va_space = 0
kernel.yama.ptrace_scope = 0

# ---- Transparent HugePages -----------------------------------------
vm.transparent_hugepage.enabled = always

# ---- Network ---------------------------------------------------------
net.core.rmem_max = 2500000
net.core.wmem_max = 2500000
net.core.rmem_default = 1250000
net.core.wmem_default = 1250000
net.ipv4.tcp_congestion_control = bbr
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_ecn = 0

# ---- Filesystem ------------------------------------------------------
fs.file-max = 2097152
fs.inotify.max_user_watches = 524288

# ---- Security --------------------------------------------------------
kernel.sysrq = 0
EOF

sudo sysctl --system
echo "✔ Sysctl parameters loaded"

# -----------------------------------------------------------------
# 3.  CPU governor & power settings
# -----------------------------------------------------------------
sudo apt-get install -y linux-tools-common linux-tools-generic cpupower
sudo cpupower frequency-set -g performance
echo "performance" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

# -----------------------------------------------------------------
# 4.  Disable services that move IRQs or swap
# -----------------------------------------------------------------
sudo systemctl disable --now irqbalance
sudo swapoff -a
sudo sed -i '/ swap / s/^/#/' /etc/fstab   # comment swap line

# -----------------------------------------------------------------
# 5.  GPU driver tweaks (example for NVIDIA – adapt for AMD)
# -----------------------------------------------------------------
# NVIDIA: create modprobe file
cat <<'EOF' | sudo tee /etc/modprobe.d/nvidia-performance.conf
options nvidia NVreg_RegistryDwords="PowerMizerEnable=0x0"
options nvidia NVreg_RegistryDwords="EnableCoolbits=28"
EOF
# Reload driver (requires you to be on a console, not inside X)
sudo rmmod nvidia_modeset nvidia_uvm nvidia_drm nvidia || true
sudo modprobe nvidia

# AMD: set power profile to performance (run after boot)
if [ -d /sys/class/drm/card0/device ]; then
    echo performance | sudo tee /sys/class/drm/card0/device/power_dpm_state
fi

# -----------------------------------------------------------------
# 6.  I/O scheduler & queue depth (example for /dev/sda)
# -----------------------------------------------------------------
for dev in /sys/block/sd*; do
    echo none | sudo tee "$dev/queue/scheduler"
    echo 64   | sudo tee "$dev/queue/nr_requests"
    echo 128  | sudo tee "$dev/queue/read_ahead_kb"
done

# -----------------------------------------------------------------
# 7.  IRQ affinity for main NIC (example NIC IRQ 45 → CPU2)
# -----------------------------------------------------------------
# Find the IRQ number for your NIC first: cat /proc/interrupts
# Then set a bitmask (CPU2 = 0x4)
# echo 4 | sudo tee /proc/irq/45/smp_affinity

# -----------------------------------------------------------------
# 8.  Final step – rebuild grub and reboot
# -----------------------------------------------------------------
sudo update-grub
echo "All done! Reboot now to activate the kernel boot parameters."

To revert everything:

  1. Remove the file /etc/sysctl.d/99-gaming-performance.conf and run sudo sysctl --system.
  2. Edit /etc/default/grub and delete the custom flags you added, then sudo update-grub.
  3. Restore the CPU governor: sudo cpupower frequency-set -g powersave.
  4. Re‑enable swap: uncomment the line in /etc/fstab and sudo swapon -a.
  5. Re‑enable irqbalance: sudo systemctl enable --now irqbalance.
  6. Remove GPU‑specific modprobe files and reload the driver.
  7. Reset I/O scheduler to default (mq-deadline or bfq), e.g. echo mq-deadline | sudo tee /sys/block/sd*/queue/scheduler.

Caveats & Recommendations

Area Why it matters What you might notice if you go too far
Security mitigations mitigations=off removes Spectre/Meltdown protections. On a compromised machine this can lead to data leakage. Kernel may crash on newer microcode updates; some distributions refuse to boot with these flags on certain CPUs.
C‑states / SMT Disabling sleep and hyper‑threading eliminates latency spikes but dramatically raises power draw and temperature. System may run hotter, fan noise increases, battery life drops on laptops.
Swappiness / Swap Setting swappiness=0 + disabling swap eliminates page‑fault stalls, but if you ever exceed RAM you will OOM‑kill processes. Crashes if you launch a memory‑hungry game while other apps are running.
Transparent HugePages always can increase memory usage and sometimes cause latency spikes on NUMA systems. Slightly higher RAM consumption; occasional “out‑of‑memory” warnings on low‑RAM machines.
IRQ affinity Pinning NIC IRQs helps latency but may starve other devices if you pick the wrong core. Network stalls or degraded performance on other peripherals.
GPU driver tweaks Disabling PowerMizer removes GPU throttling, but the GPU may run hotter and may trigger driver watchdog resets. Overheating, possible driver crashes, reduced GPU lifespan.
Filesystem mount options nojournal improves write latency but loses journal protection on power loss. Risk of filesystem corruption after a crash.

Best practice – apply changes incrementally, test after each group, and keep a backup of the original configuration files (/etc/default/grub, /etc/sysctl.conf, etc.).

Quick reference table (compact)

# Setting Value (perf) Where
CPU cpu governor = performance cpupower frequency-set -g performance userspace
CPU intel_idle.max_cstate=1 GRUB
CPU nosmt GRUB
CPU isolcpus=2,3 GRUB
Sched kernel.sched_min_granularity_ns=1000000 /etc/sysctl.d
Sched kernel.sched_wakeup_granularity_ns=1500000 /etc/sysctl.d
Mem vm.swappiness=0 /etc/sysctl.d
Mem vm.vfs_cache_pressure=50 /etc/sysctl.d
Mem vm.dirty_ratio=5 vm.dirty_background_ratio=2 /etc/sysctl.d
Mem vm.nr_hugepages=1024 /etc/sysctl.d
Mem transparent_hugepage=always /sys/kernel/...
IO elevator=none GRUB / /sys/block/*
IO nr_requests=64 read_ahead_kb=128 /sys/block/*
Net net.ipv4.tcp_congestion_control=bbr /etc/sysctl.d
Net net.core.rmem_max=2500000 net.core.wmem_max=2500000 /etc/sysctl.d
Sec mitigations=off nopti spectre_v2=off GRUB
Sec kernel.randomize_va_space=0 /etc/sysctl.d
GPU NVreg_RegistryDwords="PowerMizerEnable=0x0" /etc/modprobe.d
GPU EnableCoolbits=28 /etc/modprobe.d
GPU AMD power_dpm_state=performance /sys/class/drm/card0/device
Misc irqbalance disabled systemd
Misc swapoff -a + comment swap /etc/fstab
Misc fs.file-max=2097152 fs.inotify.max_user_watches=524288 /etc/sysctl.d

TL;DR – What to try first for a noticeable gaming boost

  1. Set CPU governor to performance.
  2. Add mitigations=off and nosmt to GRUB (reboot).
  3. Turn off swap (swapoff -a) and set vm.swappiness=0.
  4. Use the bbr TCP congestion algorithm (sysctl -w net.ipv4.tcp_congestion_control=bbr).
  5. Force the I/O scheduler to none on your SSD (elevator=none).
  6. Give the GPU its “performance” power profile (echo performance > …).

These six steps alone usually give 5‑15 % lower frame‑time variance and a smoother gaming experience on most modern hardware.

Feel free to cherry‑pick the rest of the table for further fine‑tuning, but always keep a backup of your original configs and test after each change! Happy (fast) gaming!

Read next