Additional zram + swap tuning
This commit is contained in:
@@ -1,19 +1,9 @@
|
|||||||
# Compressed swap in RAM, sized the way Fedora has shipped it since F34: all of
|
# Compressed swap in RAM. zstd averages around 3:1, so even a full device
|
||||||
# memory, capped at 8G. Fedora weighed the worry that incompressible pages would
|
# occupies roughly a third of RAM. Any smaller cap spills reclaim to the disk
|
||||||
# tie up RAM against five years of desktops reporting no trouble from it, which
|
# swapfile, which on encrypted installs pages back through LUKS.
|
||||||
# is more field evidence than we could gather on our own.
|
|
||||||
#
|
|
||||||
# The cap is what bounds the downside. A browser-heavy desktop can drive zstd
|
|
||||||
# down near 1.1:1, where the device backs far less than it advertises, and 8G
|
|
||||||
# keeps that bounded on any machine large enough to notice. The disk swapfile
|
|
||||||
# sits behind it at pri=0 for everything past that.
|
|
||||||
#
|
|
||||||
# Fedora spells this zram-fraction = 1.0 with max-zram-size = 8192; both keys
|
|
||||||
# are deprecated in favour of zram-size, which computes the same numbers.
|
|
||||||
[zram0]
|
[zram0]
|
||||||
zram-size = min(ram, 8192)
|
zram-size = ram
|
||||||
compression-algorithm = zstd
|
compression-algorithm = zstd
|
||||||
|
|
||||||
# Above the pri=0 that omarchy-hibernation-setup gives the disk swapfile, so
|
# Above the pri=0 that omarchy-hibernation-setup gives the disk swapfile.
|
||||||
# zram absorbs everything until it's full.
|
|
||||||
swap-priority = 100
|
swap-priority = 100
|
||||||
|
|||||||
@@ -7,8 +7,13 @@ net.ipv4.tcp_mtu_probing=1
|
|||||||
# Anything above 100 tells the kernel that evicting an anonymous page is
|
# Anything above 100 tells the kernel that evicting an anonymous page is
|
||||||
# cheaper than dropping a page-cache page it would have to re-read from disk.
|
# cheaper than dropping a page-cache page it would have to re-read from disk.
|
||||||
# With a compressed RAM device that is true, so the disk-era default of 60
|
# With a compressed RAM device that is true, so the disk-era default of 60
|
||||||
# leaves the page cache starved.
|
# leaves the page cache starved. Stop at 150: every page swapped still costs
|
||||||
vm.swappiness=180
|
# a compression now and a decompression on fault-back.
|
||||||
|
vm.swappiness=150
|
||||||
|
|
||||||
|
# Halve the eagerness to drop dentry/inode cache, which is costly to rebuild
|
||||||
|
# and can't spill to zram. Not lower: 0 can OOM.
|
||||||
|
vm.vfs_cache_pressure=50
|
||||||
|
|
||||||
# Read one page per swap-in fault. The default of 8 pays for a seek that zram
|
# Read one page per swap-in fault. The default of 8 pays for a seek that zram
|
||||||
# doesn't have, and every extra page costs a separate decompression.
|
# doesn't have, and every extra page costs a separate decompression.
|
||||||
@@ -21,3 +26,11 @@ vm.watermark_boost_factor=0
|
|||||||
# Keep ~1.25% of memory free instead of 0.1%, so kswapd reclaims in the
|
# Keep ~1.25% of memory free instead of 0.1%, so kswapd reclaims in the
|
||||||
# background rather than letting allocations stall in direct reclaim.
|
# background rather than letting allocations stall in direct reclaim.
|
||||||
vm.watermark_scale_factor=125
|
vm.watermark_scale_factor=125
|
||||||
|
|
||||||
|
# Cap dirty pages at 64M/256M instead of the default 10%/20% of RAM, which
|
||||||
|
# lets gigabytes of writeback pile up and flush in stalling bursts.
|
||||||
|
vm.dirty_background_bytes=67108864
|
||||||
|
vm.dirty_bytes=268435456
|
||||||
|
|
||||||
|
# With bursts bounded above, the flusher can wake every 15s instead of 5s.
|
||||||
|
vm.dirty_writeback_centisecs=1500
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Arch's kernel enables zswap by default, which in front of swap-on-zram just
|
||||||
|
# double-compresses pages and breaks zramctl accounting. Boot-only (w!), so
|
||||||
|
# flipping it on by hand for an experiment sticks until reboot.
|
||||||
|
w! /sys/module/zswap/parameters/enabled - - - - N
|
||||||
Reference in New Issue
Block a user