diff --git a/hosts/idols-ai/default.nix b/hosts/idols-ai/default.nix index 2b88e94a..fc6719e2 100644 --- a/hosts/idols-ai/default.nix +++ b/hosts/idols-ai/default.nix @@ -42,6 +42,20 @@ in # Disable the whole module (zram device + its swappiness=180 sysctl tunings); this host uses a disk swapfile instead. modules.zram.enable = false; + # zswap: compressed writeback cache in front of the disk swapfile. + # Keeps swapped cold anon pages compressed in RAM instead of the SSD, which frees more + # page cache for the ~78GB mmap'd LLM weights (mmap file pages never go through zswap). + # Safe here: disk swapfile remains the real backing store, no zram deadlock structure. + # - zstd: CPU is not the bottleneck here (llama.cpp peaks ~30% util); its ~2.5x ratio + # keeps ~5G more anon bytes in the capped pool than lz4, and ~5us decompress is noise + # vs the ~100us SSD fault it avoids. + # - 10% pool (~9G): the module default 25% (~23G) would compete with the weight cache. + boot.zswap = { + enable = true; + compressor = "zstd"; + maxPoolPercent = 10; + }; + services.sunshine.enable = false; services.tuned.ppdSettings.main.default = lib.mkForce "performance";