feat(memory): enable zram compressed-RAM swap by default (#76 slice)
All checks were successful
Check / eval (push) Successful in 4m1s
All checks were successful
Check / eval (push) Successful in 4m1s
First slice of BACKLOG #76 (hibernation + zram, split): zramSwap on by default in modules/nixos/oom.nix — the memory-pressure layer before earlyoom. zstd @ 50% RAM (nixpkgs defaults, explicit for reproducibility), priority 100 so day-to-day paging fills zram first and any disk swapfile stays reserved for #76's hibernate image (hibernation can't resume from volatile zram). Follows the earlyoom mkDefault precedent — no toggle. Adds checks.zram-swap runNixOSTest importing oom.nix, asserting the device is an active swap, uses [zstd], and carries priority 100. Verified: V2 checks.zram-swap PASS (/dev/zram0 in /proc/swaps, zstd, prio 100); V1 full distro toplevel builds; V0 flake check --no-build green. #76 remainder (disk swapfile default + resume + installer) still open. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -28,12 +28,18 @@ in [`docs/ROADMAP.md`](../docs/ROADMAP.md); map in
|
||||
|
||||
## NEXT
|
||||
|
||||
### 76. Hibernation default + zram `[big]`
|
||||
### 76. Hibernation default `[big]`
|
||||
**Product intent (Bernardo 2026-07-10):** hibernation on by default;
|
||||
zram on alongside for live memory pressure. Disk swap ≥ RAM for the
|
||||
hibernate image; zram high-priority for day-to-day swap (not sufficient
|
||||
alone for resume).
|
||||
|
||||
**✓ zram slice shipped (2026-07-10):** `zramSwap` on by default in
|
||||
`modules/nixos/oom.nix` (zstd, 50% RAM, priority 100 so day-to-day paging
|
||||
stays off the disk swap reserved for the hibernate image); `checks.zram-swap`
|
||||
VM test asserts device/algorithm/priority (V2 pass). **Remainder below is the
|
||||
hibernation half** — disk swapfile default + resume + installer.
|
||||
|
||||
**Reference layout (this machine — already hibernation-capable, no zram
|
||||
yet):** LUKS (`crypto_LUKS` → mapper `crypted`) holds one BTRFS with
|
||||
`@swap` mounted at `/swap`; swapfile `/swap/swapfile` (here 16G);
|
||||
@@ -47,12 +53,12 @@ Installer path already sketches this (`@swap` + resume_offset patch in
|
||||
|
||||
**Scope (split before/while implementing — do not land as one mega-PR):**
|
||||
|
||||
1. **Design** — default `swapSize` (= RAM? round up?), zram size/priority
|
||||
vs disk prio, LUKS+systemd-initrd resume (already used), what when
|
||||
install chose `swapSize=0`, migration for existing machines.
|
||||
2. **Module** — NixOS: enable zram by default; ensure hibernation knobs
|
||||
are coherent when swapfile exists (resume device/offset); Power menu
|
||||
Hibernate already present — must work when swap is configured.
|
||||
1. **Design** — default `swapSize` (= RAM? round up?), LUKS+systemd-initrd
|
||||
resume (already used), what when install chose `swapSize=0`, migration
|
||||
for existing machines. (zram priority-vs-disk already settled + shipped.)
|
||||
2. **Module** — NixOS: ensure hibernation knobs are coherent when swapfile
|
||||
exists (resume device/offset); Power menu Hibernate already present —
|
||||
must work when swap is configured. (zram already default-on in oom.nix.)
|
||||
3. **Installer** — default new installs to hibernation-ready `@swap`
|
||||
swapfile (encrypted with root); keep `0` = no swap opt-out; document
|
||||
migration.
|
||||
@@ -62,11 +68,9 @@ Installer path already sketches this (`@swap` + resume_offset patch in
|
||||
(`runNixOSTest` or install-test style) — encrypted root + BTRFS
|
||||
`@swap` swapfile + resume_offset; prove hibernate→resume path at
|
||||
least as far as QEMU allows (fail the item if only “config
|
||||
evaluates”). Also assert zram is active with expected priority
|
||||
relative to the swapfile.
|
||||
evaluates”).
|
||||
- **V3:** real laptop (this LUKS+@swap layout): Hibernate → power off
|
||||
→ resume session; queue HARDWARE-QUEUE. zram under load is
|
||||
secondary.
|
||||
→ resume session; queue HARDWARE-QUEUE.
|
||||
|
||||
**Out of scope:** TLP; formatter. Prefer boring NixOS knobs; extend the
|
||||
existing installer swapfile story rather than inventing a second layout.
|
||||
|
||||
@@ -17,6 +17,22 @@ Template:
|
||||
|
||||
---
|
||||
|
||||
## 2026-07-10 — #76 zram slice: compressed-RAM swap default
|
||||
- **Task:** BACKLOG #76 (`[big]`) — split; took the low-risk zram-default slice.
|
||||
- **Did:** `zramSwap` on by default in `modules/nixos/oom.nix` (zstd, 50% RAM,
|
||||
priority 100) as the memory-pressure layer before earlyoom, following the
|
||||
earlyoom mkDefault precedent (no toggle). High priority keeps day-to-day
|
||||
paging in zram so a disk swapfile stays reserved for #76's hibernate image.
|
||||
Added `checks.zram-swap` runNixOSTest (imports oom.nix). Split #76 in
|
||||
BACKLOG → remainder is the hibernation half (swapfile/resume/installer).
|
||||
- **Verified:** **V2** — `nix build .#checks…zram-swap` PASS: /dev/zram0 active
|
||||
in /proc/swaps, `[zstd]` comp_algorithm, priority 100. **V1** full distro
|
||||
toplevel builds. **V0** flake check --no-build green.
|
||||
- **Pending:** hibernation half of #76 still open (needs hibernate→resume VM
|
||||
test + V3 laptop). No V3 for zram (under-load tuning is secondary).
|
||||
- **Next suggestion:** #76 hibernation half — design default swapSize + the
|
||||
resume/installer wiring; it's the boot-critical, V2-hibernate + V3 part.
|
||||
|
||||
## 2026-07-10 — #41 hardware-confirmed: OpenFile portal floats (V3 close)
|
||||
- **Task:** BACKLOG #41 — final on-hardware confirmation (Bernardo reported PASS).
|
||||
- **Did:** #41 already out of NEXT + portal rule shipped
|
||||
|
||||
Reference in New Issue
Block a user