Turbocharging Linux: High-Performance sysctl Settings Explained

This guide provides a performance-focused sysctl configuration for Linux, tuned for low latency and high throughput on desktop or gaming systems. Learn how to apply, test, and revert these settings safely—without touching GRUB or boot parameters.

Turbocharging Linux: High-Performance sysctl Settings Explained

Below is a “performance‑first” sysctl‑only tuning guide.
Everything listed can be changed at run‑time with sysctl -w … and made permanent by putting the line in a file under /etc/sysctl.d/ (or directly in /etc/sysctl.conf).
No GRUB or other boot‑loader options are used.

Important – The values shown are the ones that give the lowest latency / highest throughput on typical desktop‑or‑gaming hardware.
They often sacrifice security, power‑saving, and sometimes stability. Test each change on a non‑critical system first and keep a copy of the original file so you can roll back quickly.

1. How to Apply the Settings

# 1. Create a dedicated file (easier to revert)
sudo tee /etc/sysctl.d/99‑performance.conf > /dev/null <<'EOF'
# <--- the full list appears below, copy‑paste it here ---->
EOF

# 2. Load the new values immediately
sudo sysctl --system

# 3. Verify a few key knobs
sysctl -a | grep -E 'swappiness|dirty|sched|vfs|hz|randomize|bbr|noexec|ptrace|kernel\.yama'

To undo everything, simply delete the file and reload:

sudo rm /etc/sysctl.d/99‑performance.conf
sudo sysctl --system

2. Full “Performance‑Mode” sysctl List

Legend – each entry shows
parameter = value # comment (default: X)
The comment tells you the default on a stock Ubuntu/Debian‑based kernel (≈5.15‑6.6). Your distro may differ slightly.

# ----------------------------------------------------------------------
# 1. Scheduler / CPU latency
# ----------------------------------------------------------------------
kernel.sched_min_granularity_ns = 1000000       # default: 1000000 (1 ms) – lower = more pre‑emptive
kernel.sched_wakeup_granularity_ns = 1500000   # default: 1500000 (1.5 ms) – lower = tighter wake‑up latency
kernel.sched_child_runs_first = 0              # default: 0 (keep) – keep children from pre‑empting parent
kernel.sched_migration_cost = 500000           # default: 500000 – lower = more aggressive load‑balance
kernel.sched_tunable_scaling = 0               # default: 0 (disabled) – keep static scaling
kernel.sched_autogroup_enabled = 0             # default: 1 – disable autogroup (helps low‑latency apps)

# ----------------------------------------------------------------------
# 2. Virtual memory / paging
# ----------------------------------------------------------------------
vm.swappiness = 0                              # default: 60 – 0 = never swap unless OOM
vm.vfs_cache_pressure = 50                    # default: 100 – keep inode/dentry cache longer
vm.dirty_background_ratio = 2                 # default: 10 – start write‑back earlier
vm.dirty_ratio = 5                             # default: 20 – stop dirty pages earlier
vm.dirty_writeback_centisecs = 500             # default: 500 – 5 s; keep low latency
vm.pagecache_limit_mb = 0                      # default: 0 (unlimited) – leave untouched unless low RAM
vm.overcommit_memory = 1                       # default: 0 – allow allocating beyond RAM
vm.overcommit_ratio = 100                      # default: 50 – when overcommit_memory=2, use 100%
vm.max_map_count = 262144                      # default: 65530 – raise for large‑map apps (databases, games)
vm.min_free_kbytes = 65536                     # default: 67584 – keep a small free‑memory reserve
vm.nr_hugepages = 1024                         # default: 0 – pre‑allocate 2 MiB pages for games that use THP
vm.transparent_hugepage.enabled = always       # default: madvise – force THP everywhere
vm.transparent_hugepage.defrag = always         # default: defer – make THP allocation eager
vm.zone_reclaim_mode = 0                        # default: 0 – leave as is (only matters on NUMA)

# ----------------------------------------------------------------------
# 3. CPU frequency scaling (governor) – note: this is a sysctl knob
# ----------------------------------------------------------------------
# (The governor itself is not a sysctl, but we can tell the kernel to
#  ignore the “nosmt”/C‑state bits that would otherwise be set in GRUB.)
# Nothing to do here – just make sure the governor is set to “performance”
# via cpupower (see the separate guide).  The following knobs make the
# kernel think the CPU is always “busy”, which reduces idle‑tick wake‑ups.
kernel.sched_rt_runtime_us = -1                # default: 950000 – give real‑time tasks unlimited runtime
kernel.sched_rt_period_us = 1000000            # default: 1000000 – keep 1 s period (unchanged)

# ----------------------------------------------------------------------
# 4. File‑system behaviour
# ----------------------------------------------------------------------
fs.file-max = 2097152                          # default: 8192 – raise open‑file limit
fs.inotify.max_user_watches = 524288           # default: 8192 – many asset files opened at once
fs.inotify.max_user_instances = 1024           # default: 128
fs.mqueue.msg_max = 1048576                    # default: 10 240 – raise POSIX message‑queue size
fs.mqueue.msgsize_max = 1048576                # default: 8192 – raise max message size
fs.mqueue.queues_max = 1024                    # default: 256 – raise number of queues per user

# ----------------------------------------------------------------------
# 5. Disk I/O scheduler (the *elevator* can be set via sysctl on some
#    kernels that expose it under /proc/sys) – most modern kernels expose
#    it only through the block‑device sysfs, so we use the generic
#    “/proc/sys/vm/dirty*” knobs above.  The following are still useful:
# ----------------------------------------------------------------------
# (If your distro compiled `CONFIG_IOSCHED_DEADLINE=y` you can
#  switch to it with `echo deadline > /sys/block/sdX/queue/scheduler`,
#  but that is **not** a sysctl knob – therefore it is omitted here.)

# ----------------------------------------------------------------------
# 6. Networking – throughput & low latency
# ----------------------------------------------------------------------
net.core.rmem_max = 2500000                    # default: 212992 – raise receive buffer max
net.core.wmem_max = 2500000                    # default: 212992 – raise send buffer max
net.core.rmem_default = 1250000                # default: 212992 – default receive buffer
net.core.wmem_default = 1250000                # default: 212992 – default send buffer
net.core.optmem_max = 2500000                  # default: 20480 – raise auxiliary buffer
net.core.somaxconn = 65535                     # default: 128 – max pending TCP connections
net.ipv4.tcp_congestion_control = bbr         # default: cubic – BBR gives higher throughput & lower RTT
net.ipv4.tcp_fastopen = 1                     # default: 0 – enable TFO (faster hand‑shakes)
net.ipv4.tcp_tw_reuse = 1                     # default: 0 – allow reuse of TIME_WAIT sockets
net.ipv4.tcp_tw_recycle = 0                   # default: 0 – (removed in newer kernels, keep 0)
net.ipv4.tcp_fin_timeout = 15                 # default: 60 – close FIN‑WAIT sockets faster
net.ipv4.tcp_keepalive_time = 300             # default: 7200 – keepalive more often (optional)
net.ipv4.tcp_mtu_probing = 1                  # default: 0 – enable path MTU discovery
net.ipv4.tcp_sack = 1                         # default: 1 – keep SACK enabled (do NOT disable)
net.ipv4.tcp_window_scaling = 1               # default: 1 – keep enabled (needed for high BW)
net.ipv4.tcp_rmem = 4096 1250000 2500000       # default: 4096 87380 6291456 – raise receive memory
net.ipv4.tcp_wmem = 4096 1250000 2500000       # default: 4096 16384 4194304 – raise send memory
net.core.netdev_max_backlog = 5000             # default: 1000 – allow more packets in NIC backlog
net.core.dev_weight = 64                       # default: 64 – leave as is (kept for completeness)

# ----------------------------------------------------------------------
# 7. File‑system specific knobs
# ----------------------------------------------------------------------
# (All of these are under /proc/sys/fs – they affect ext4, xfs, btrfs, etc.)
fs.protected_hardlinks = 0                     # default: 1 – disable hard‑link protection (tiny security win)
fs.protected_symlinks = 0                      # default: 1 – disable symlink protection
fs.protected_fifos = 0                         # default: 1 – disable FIFO protection
fs.protected_regular = 0                       # default: 1 – disable regular‑file protection
fs.protected_regular = 0                       # (same line, just for clarity)

# Disable exec‑shields that add extra checks on every execve()
fs.protected_regular = 0                       # default: 1 – allow exec of any regular file
kernel.exec-shield = 0                         # default: 1 – turn off the “exec‑shield” heuristics
kernel.randomize_va_space = 0                 # default: 2 – disable ASLR (address‑space layout randomisation)

# ----------------------------------------------------------------------
# 8. Security / debugging (performance side‑effects)
# ----------------------------------------------------------------------
kernel.core_pattern = /dev/null                # default: /var/crash/%e.%p.core – avoid disk I/O on crashes
kernel.core_uses_pid = 0                       # default: 1 – keep core filenames simple (irrelevant for perf)
kernel.sysrq = 0                               # default: 1 – disable SysRq (prevents accidental panics)
kernel.kptr_restrict = 0                       # default: 0 – allow reading kernel pointers (useful for debugging)
kernel.perf_event_paranoid = 0                 # default: 2 – allow unprivileged perf counters
kernel.unprivileged_userns_clone = 1           # default: 0 – allow user namespaces (optional)
kernel.yama.ptrace_scope = 0                  # default: 1 – allow any process to ptrace any other (needed by some debuggers)

# ----------------------------------------------------------------------
# 9. Miscellaneous “speed‑up” knobs
# ----------------------------------------------------------------------
fs.file-max = 2097152                          # default: 8192 – raise global open‑file limit
fs.inotify.max_user_watches = 524288           # default: 8192 – many games/launchers watch many files
fs.inotify.max_user_instances = 1024           # default: 128 – raise per‑user instance limit
fs.mqueue.msg_max = 1048576                     # default: 10 240 – raise POSIX MQ max message size
fs.mqueue.msgsize_max = 1048576                 # default: 8192 – raise max size per message
fs.mqueue.queues_max = 1024                     # default: 256 – raise per‑user queue limit
kernel.msgmax = 65536                          # default: 8192 – raise max size of a SysV message
kernel.msgmnb = 65536                          # default: 16384 – raise max size of a SysV message queue
kernel.msgpool = 65536                         # default: 0 – reserve a small pool for SysV msgs

# ----------------------------------------------------------------------
# 10. Power‑saving (disable to keep CPU/GPU at full speed)
# ----------------------------------------------------------------------
# These are *not* boot‑loader flags; they are runtime knobs that tell the
# kernel not to request low‑power states.
# (Some distros expose them via /sys, but the kernel also honors the
#  following sysctl when the driver calls them.)
kernel.hz = 1000                               # default: 250/300/1000 (depends on CONFIG_HZ) – keep higher tick rate
kernel.timer_migration = 0                     # default: 1 – keep timers on the same CPU (helps cache affinity)

# ----------------------------------------------------------------------
# End of file – everything above can be copied into /etc/sysctl.d/99‑performance.conf
# ----------------------------------------------------------------------

3. What Each Section Does (short “why it helps”)

Section What it influences Why the change helps performance
Scheduler / CPU latency Task‑switch granularity, load‑balancing aggressiveness, autogrouping. Smaller granularity forces the scheduler to pre‑empt more often, reducing the time a task sits in the run‑queue before it gets CPU. Disabling autogroup avoids the “fair‑share” throttling that can add latency to a single foreground app (e.g., a game).
Virtual memory / paging How aggressively the kernel swaps, writes dirty pages, uses huge pages, and over‑commits memory. Setting swappiness=0 + disabling swap removes the occasional page‑fault stall. Early write‑back (dirty_background_ratio/dirty_ratio) keeps the write‑back thread busy, preventing a big “flush” later that would stall the foreground app. Forcing Transparent HugePages (always) reduces TLB misses on large memory allocations (common in games and emulators).
Networking Buffer sizes, congestion algorithm, socket reuse. bbr (Bottleneck Bandwidth‑Delay Rate) gives higher throughput and lower RTT than the default cubic. Raising net.core.rmem_* and wmem_* lets the kernel keep larger socket buffers, which prevents the kernel from throttling high‑speed transfers (e.g., streaming assets from a LAN server).
File‑system / VFS Inode/dentry cache, protection flags. Reducing vfs_cache_pressure keeps directory entry and inode caches in RAM longer, which speeds up path look‑ups for games that open many small files (textures, shaders, etc.). Disabling protected_* flags removes a few extra security checks on every open()/stat() call – the cost is tiny, but it does shave a few microseconds per syscall.
Security / debugging ASLR, exec‑shield, ptrace, core‑dump handling. Disabling randomize_va_space removes address‑space randomisation, which eliminates a small amount of extra work the kernel does on every execve(). Turning off kernel.core_pattern and setting it to /dev/null prevents the kernel from writing a core‑file on a crash – this avoids a sudden disk write that would otherwise stall the system.
Miscellaneous Open‑file limits, inotify watches, hugepage pre‑allocation. Raising fs.file-max and fs.inotify.max_user_watches prevents the kernel from hitting its built‑in limits when a game launcher (Steam, Lutris, Heroic, etc.) watches hundreds of thousands of files. Pre‑allocating a modest number of 2 MiB hugepages (nr_hugepages) gives the memory allocator a ready pool of large pages, which reduces page‑table walks for large allocations.

4. “Copy‑Paste Ready” Performance sysctl.conf

Save the block below as a whole (or split it into several files if you prefer a more granular approach).
The file can be named anything you like – e.g. /etc/sysctl.d/99-performance.conf.

# ----------------------------------------------------------------------
# Performance‑only sysctl tuning (no GRUB changes)
# ----------------------------------------------------------------------
# 1. Scheduler
kernel.sched_min_granularity_ns = 1000000
kernel.sched_wakeup_granularity_ns = 1500000
kernel.sched_child_runs_first = 0
kernel.sched_migration_cost = 500000
kernel.sched_tunable_scaling = 0
kernel.sched_autogroup_enabled = 0

# 2. Virtual memory
vm.swappiness = 0
vm.vfs_cache_pressure = 50
vm.dirty_background_ratio = 2
vm.dirty_ratio = 5
vm.dirty_writeback_centisecs = 500
vm.dirty_writeback_centisecs = 500
vm.dirty_writeback_centisecs = 500
vm.overcommit_memory = 1
vm.overcommit_ratio = 100
vm.max_map_count = 262144
vm.min_free_kbytes = 65536
vm.nr_hugepages = 1024
vm.transparent_hugepage.enabled = always
vm.transparent_hugepage.defrag = always

# 3. Networking (TCP)
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
net.ipv4.tcp_fastopen = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_mtu_probing = 1
net.core.netdev_max_backlog = 5000

# 4. Filesystem / VFS
fs.file-max = 2097152
fs.inotify.max_user_watches = 524288
fs.inotify.max_user_instances = 1024
fs.protected_hardlinks = 0
fs.protected_symlinks = 0
fs.protected_fifos = 0
fs.protected_regular = 0
kernel.exec-shield = 0
kernel.randomize_va_space = 0

# 5. Security / debugging (performance side‑effects)
kernel.sysrq = 0
kernel.yama.ptrace_scope = 0
kernel.core_pattern = /dev/null
kernel.core_uses_pid = 0
kernel.perf_event_paranoid = 0

# 6. Misc
vm.max_map_count = 262144
fs.mqueue.msg_max = 1048576
fs.mqueue.msgsize_max = 1048576
fs.mqueue.queues_max = 1024

Tip: If you only want a “quick‑and‑dirty” boost, copy the first 20‑30 lines (scheduler + VM) and test; the networking and file‑system tweaks add extra head‑room for high‑throughput scenarios (downloading game assets, streaming video, etc.).

5. Verifying the Effect

After you have re‑loaded the file:

# Show the most important values side‑by‑side with their defaults
sysctl -a | grep -E 'swappiness|dirty|sched|vfs|transparent_hugepage|bbr|randomize|core_pattern|ptrace' | column -t

You can also measure latency before/after with a few simple tools:

Tool What it measures Example command
latencytop Kernel‑level latency sources (scheduler, VM, I/O) sudo latencytop
perf stat -e cycles,instructions,cache-misses,cache-references <program> CPU‑level micro‑architectural counters perf stat -e cycles,instructions ./mygame
iostat -xz 1 Disk I/O latency & throughput iostat -xz 1
ss -s Socket statistics (look for “retrans”, “timewait”) ss -s
cat /proc/meminfo Swapping, dirty pages, hugepages usage `watch -n1 grep -E 'Swap

If you notice instability, OOM kills, or overheating, dial the values back toward the defaults (e.g., raise vm.swappiness to 10, set vm.vfs_cache_pressure back to 100, re‑enable autogroup, etc.).

5. Kernel‑Version Caveats

  • The exact list of available keys depends on the kernel you run (sysctl -a shows everything).
  • Newer kernels (≥ 5.19) have additional knobs such as kernel.sched_nr_migrate, kernel.sched_nr_migrate, kernel.sched_nr_migrate, kernel.sched_nr_migrate, etc. If they appear on your system you can tune them in the same way (lower values → more aggressive load‑balancing).
  • Some knobs are read‑only on certain distributions (e.g., kernel.randomize_va_space may be forced to 2 by a hardened profile). In that case you must use a boot‑loader flag; the guide above respects the “no‑GRUB” requirement, so those knobs are omitted.

5. Minimal “one‑file” Performance Profile

If you just want a single file you can drop into /etc/sysctl.d/ and be done with it, copy the block below:

# /etc/sysctl.d/99-performance.conf  – minimal but effective

# Scheduler (tight pre‑emptive behaviour)
kernel.sched_min_granularity_ns = 1000000
kernel.sched_wakeup_granularity_ns = 1500000
kernel.sched_autogroup_enabled = 0

# Virtual memory (no swap, early write‑back)
vm.swappiness = 0
vm.vfs_cache_pressure = 50
vm.dirty_background_ratio = 2
vm.dirty_ratio = 5
vm.overcommit_memory = 1
vm.transparent_hugepage.enabled = always
vm.transparent_hugepage.defrag = always

# Networking (BBR + big buffers)
net.ipv4.tcp_congestion_control = bbr
net.core.rmem_max = 2500000
net.core.wmem_max = 2500000
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_ecn = 0

# Security / debugging (speed‑over‑security)
kernel.randomize_va_space = 0
kernel.exec-shield = 0
kernel.yama.ptrace_scope = 0
kernel.sysrq = 0

Load it with sudo sysctl --system and reboot (optional – most changes take effect immediately).

Final Note

These sysctl adjustments are purely software‑side; they do not replace the far more powerful gains you get from:

  • Setting the CPU governor to performance (cpupower frequency-set -g performance).
  • Choosing a low‑latency I/O scheduler (deadline or mq‑deadline) via the block‑device sysfs.
  • Using a performance‑oriented kernel (e.g., the linux-lowlatency or linux-zen kernels on Arch, or the linux-rt variant on Debian/Ubuntu).

When combined, the runtime sysctl knobs above give you a noticeable, measurable reduction in system latency and a smoother experience for most desktop workloads, especially gaming, emulation, and high‑throughput networking. Enjoy the speed!

Read next

How to check health of NVMe SSD on ubuntu

A practical, step-by-step guide to checking NVMe SSD health on Ubuntu using nvme-cli, smartctl, and GNOME Disks. Learn how to read SMART data, spot early warning signs, run self-tests, update firmware, and keep your data safe.