Skip to content

fix(cloud): discount shrinkable ZFS ARC from host memory used - #102

Merged
marvinvr merged 2 commits into
mainfrom
fix/zfs-arc-host-memory
Oct 3, 2026
Merged

marvinvr merged 2 commits into
mainfrom
fix/zfs-arc-host-memory

Conversation

@marvinvr

@marvinvr marvinvr commented Oct 3, 2026

Copy link
Copy Markdown
Owner

What

Host memory used is MemTotal - MemAvailable. The ZFS ARC lives outside the Linux page cache, so the kernel counts it as used even though ZFS gives it back under pressure. On ZFS hosts (Proxmox, TrueNAS), the cache alone can push a host over the host-pressure memory threshold.

This subtracts the shrinkable part of the ARC (size - c_min from /proc/spl/kstat/zfs/arcstats, the same figure htop/btop use). Hosts without ZFS are unchanged.

Tests

Added cloud/hostmetrics_test.go, which covers meminfo without ZFS, the ARC discount, and an ARC at its floor.

🤖 Generated with Claude Code

The ARC lives outside the page cache, so MemAvailable counts it as used
and ZFS hosts (Proxmox, TrueNAS) can trip the host-pressure memory alert
on cache alone. Subtract size - c_min from arcstats, like htop/btop.
@marvinvr
marvinvr merged commit f24f0e1 into main Oct 3, 2026
9 checks passed
@marvinvr
marvinvr deleted the fix/zfs-arc-host-memory branch October 3, 2026 19:43
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