Commit 1c5d2a56a5ae

Vincent Demeester <vincent@sbr.pm>
2026-02-11 12:30:17
fix(okinawa): increase swap for LLM workloads
Implemented hybrid swap strategy optimized for LLM inference: - Added 16GB zram swap (compressed, RAM-based, priority 10) - Increased disk swap from 8GB to 16GB (fallback, priority 5) - Total effective memory: ~104GB (32GB RAM + ~48GB zram + 16GB disk + 8GB VRAM) This prevents OOM kills when running multiple models simultaneously or using large models with CPU offload, while maintaining performance through fast zram compression (3:1 ratio for model weights).
1 parent 6a2a903
Changed files (3)
systems/aomi/home.nix
@@ -12,6 +12,14 @@
     ../../home/common/desktop/passage.nix
     ../../home/common/shell/gh.nix
   ];
+
+  # Enable Emacs daemon
+  services.emacs = {
+    enable = true;
+    client.enable = true;
+    socketActivation.enable = true;
+  };
+
   systemd.user.services.syncthing.Install.WantedBy = [ "multi-user.target" ];
 
   home.sessionVariables = {
systems/okinawa/extra.nix
@@ -1,7 +1,5 @@
 {
-  config,
   pkgs,
-  lib,
   libx,
   globals,
   ...
systems/okinawa/hardware.nix
@@ -21,11 +21,25 @@
     ../common/hardware/bluetooth.nix
   ];
 
-  # Swapfile on root partition (8GB for 32GB RAM system)
+  # Hybrid swap strategy for LLM workloads:
+  # - zram: Fast compressed RAM-based swap (primary tier)
+  # - disk: Safety net for extreme memory pressure (secondary tier)
+  # Total effective memory: 32GB RAM + ~48GB zram (compressed) + 16GB disk
+
+  # zram swap (compressed, RAM-based)
+  zramSwap = {
+    enable = true;
+    algorithm = "zstd";
+    memoryPercent = 50; # 16GB of 32GB RAM for zram
+    priority = 10; # Higher priority than disk swap
+  };
+
+  # Disk swapfile (fallback tier)
   swapDevices = [
     {
       device = "/swapfile";
-      size = 8 * 1024; # 8GB
+      size = 16 * 1024; # 16GB (increased from 8GB)
+      priority = 5; # Lower priority than zram
     }
   ];