Skip to content

[Bug] “active” metric from si.mem() does not exclude ZFS ARC cache #808

Description

@callumgare

Describe the bug
The “active” metric returned by si.mem() is designed to exclude cached memory with the logic being that such memory is guaranteed to be released if needed for other processes. Memory used by Linux’s page cache is considered cached and thus excluded however the file system ZFS uses its own page cache equivalent called ARC and even though it also functions the same way, releasing memory as needed, that is not currently excluded from the active metric. Since ARC will happily use up nearly all available memory “active” can be fairly misleading on systems using ZFS since memory is shown to be always at near capacity, and that can hide when real memory usage is growing as ARC will release memory at the same rate up until it has no more memory to release resulting in the system running out of memory.

Support for excluding ARC memory usage in the active memory stat of other programs varies between program (I’m assuming because ZFS on Linux is a wasn’t around when some of those programs have been written). The popular cli resource usage program htop is one program that does:
image
(It shows cached memory including ZFS ARC in yellow for reference but that memory is excluded from the "17.3G" figure of actively used memory.)

To Reproduce
On a system running ZFS calling the command sudo arc_summary should give the amount of memory used by ARC which combined with unused memory + any memory usage from the Linux page cache (which can be found using free) will give a value larger than the “available” metric returned by si.mem()

Expected behaviour
The value of “active” would exclude the amount of memory used by ARC minus the minimum ARC size (ARC is configured not to shrink below whatever it's minimum size is set to so that minimum size can be effectively considered actually used memory, not available memory). And since the value of “available” is calculated using “active” then ZFS ARC usage would be counted there.
image

Environment (please complete the following information):

  • systeminformation package version: 5.17.12
  • OS: Debian 11
  • Hardware: Desktop PC

Additional context
This is a similar ticket I opened to do the same thing with the resource usage app netdata which may or may not be useful for checking out how they implemented it: netdata/netdata#12843

Thanks for reading!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions