Skip to content

stability: always enable zram (drop memory-total gate)#756

Merged
cyberb merged 6 commits into
masterfrom
zram-always-on
Jul 9, 2026
Merged

stability: always enable zram (drop memory-total gate)#756
cyberb merged 6 commits into
masterfrom
zram-always-on

Conversation

@cyberb

@cyberb cyberb commented Jul 9, 2026

Copy link
Copy Markdown
Member

What

Remove the 6 GiB MemTotal gate in backend/stability/zram.go so EnsureConfigured() always configures zram, regardless of total/available RAM.

Why

The gate skipped exactly the boxes that benefit most: high-RAM but heavily-loaded machines (e.g. boris prod — 8 GB, ~15 snaps) fell above the 6 GiB threshold and never got compressed swap. Compressed swap is cheap headroom on any box, and alreadyOn() keeps configuration idempotent, so unconditional enable is safe.

Resolves the "Decision needed: how to lift the gate" item in TODO-zram-health.md (the Health-page si/so + iowait visibility work remains open).

Changes

  • zram.go: drop memThresholdKB and the skip branch.
  • zram_test.go: remove the now-obsolete above-threshold skip test.
  • TODO-zram-health.md: record the decision (gate removed, always-on).
  • TODO.md: drop gptfdisk from the 3rdparty migration list (already migrated in-tree).

Test

go test ./stability/ passes locally.

cyberb added 6 commits July 9, 2026 08:47
Compressed swap is cheap headroom even on high-RAM boxes; the 6 GiB
MemTotal gate skipped exactly the pressured 8 GB multi-snap boxes (boris
prod) that benefit most. Remove the gate so EnsureConfigured always
configures zram; alreadyOn() keeps it idempotent.
Old buster kernels (4.19) expose zram comp_algorithm without zstd
([lzo] lz4 lz4hc). Writing zstd there fails EINVAL, which aborted
EnsureConfigured before disksize/swapon, so zram never came up. zram
already has a working default algorithm, so treat the comp_algorithm
write as best-effort and only require disksize. Surfaced on borisarm64
(amd64 buster) once the memory gate was removed.
The swap fullness bar can't distinguish cold parked pages (benign) from
active thrashing. Collect pswpin/pswpout from /proc/vmstat as
swap_in_pages/swap_out_pages; the frontend deltas them like disk rates
and renders 'in X · out Y KB/s' under the swap bar. Missing /proc/vmstat
(or absent counters) degrades to 0. PSI intentionally left out — no
kernel support on the target boxes.
@cyberb cyberb merged commit aea1b05 into master Jul 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant