This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

ignavia: tune IO so bulk writes don't stall reads

The whole system lives on one btrfs-on-LUKS-on-NVMe device, so downloads
and builds were starving latency-sensitive reads — launching a terminal
would freeze for seconds (PSI full IO pressure spikes, near-zero CPU/mem
pressure). Three independent fixes:

- mq-deadline scheduler on nvme0n1: the default "none" gives no read/write
fairness, so reads queued behind up to 1023 writes.
- vm.dirty_bytes/dirty_background_bytes as small fixed values instead of
the ratio defaults (~6/12 GB on 62 GB RAM) that caused multi-GB flush
bursts.
- bypassWorkqueues on the LUKS device to drop the kcryptd serialization
point (safe: AES-NI is present).

Assisted-by: Claude Code (claude-fable-5)

+24
+24
machines/ignavia/physical.nix
··· 52 52 "xhci_pci" 53 53 "usbhid" 54 54 ]; 55 + 56 + # IO latency tuning. The whole system (/, /home, /nix) lives on one 57 + # btrfs-on-LUKS-on-NVMe device, so bulk writes (downloads, builds) can starve 58 + # latency-sensitive reads — e.g. launching a terminal stalls for seconds. 59 + # Three independent causes, three fixes: 60 + 61 + # 1. NVMe defaults to scheduler "none" (FIFO, no read/write fairness), so a 62 + # read queues behind up to nr_requests (1023) writes. mq-deadline gives 63 + # reads deadline priority over bulk writes. 64 + services.udev.extraRules = '' 65 + ACTION=="add|change", KERNEL=="nvme0n1", ATTR{queue/scheduler}="mq-deadline" 66 + ''; 67 + 68 + # 2. Default dirty-page limits are ratio-based: ~6.2 GB background / ~12.4 GB 69 + # hard on 62 GB RAM. Writes pool in RAM then flush in multi-GB bursts that 70 + # flood the queue and freeze everything (PSI full IO). Small fixed byte 71 + # limits make writeback continuous instead of bursty. 72 + boot.kernel.sysctl."vm.dirty_bytes" = 268435456; # 256 MiB 73 + boot.kernel.sysctl."vm.dirty_background_bytes" = 67108864; # 64 MiB 74 + 75 + # 3. dm-crypt funnels all IO through the kcryptd workqueue, a serialization 76 + # point under load. AES-NI is present so inline crypto is cheap — bypass 77 + # the queues to cut crypt-layer latency. Device name from disk.nix. 78 + boot.initrd.luks.devices.aergia1.bypassWorkqueues = true; 55 79 }