Visitar URL original
[FEAT] Subtract ZFS ARC from memory usage · Issue #1995 · fastfetch-cli/fastfetch · GitHub
Skip to content

[FEAT] Subtract ZFS ARC from memory usage #1995

Closed

Description

@leo60228

Description

The displayed memory in use should exclude ZFS's ARC, similarly to tools like htop.

Motivation

Implementing this in a shell is non-trivial, and it's a logical extension of existing functionality.

Additional context

Due to Linux kernel limitations, ZFS's in-memory caches aren't included in MemAvailable despite being logically equivalent. fastfetch should subtract the size of ZFS's cache, similarly to other tools like htop. There's already ZFS-specific code in fastfetch for filesystem handling.

This can be implemented by reading /proc/spl/kstat/zfs/arcstats in addition to /proc/meminfo if it's present, and adding size - c_min to MemAvailable.

Activity

  1. CarterLi commented on Oct 13, 2025

    @CarterLi
    Member

    Any additional information? Htop source? Is it required on FreeBSD and Solaris?

  2. leo60228 commented on Oct 14, 2025

    @leo60228
    Author

    I don't know for sure but I assume not. The root cause of this is how the Linux kernel computes MemAvailable. The ZFS issue for it is here, but it doesn't show any path to being closed: openzfs/zfs#10251

  3. leo60228 commented on Oct 14, 2025

    @leo60228
    Author

    Here's the relevant code in htop and btop.

  4. CarterLi commented on Oct 15, 2025

    @CarterLi
    Member

    The ZFS issue for it is here, but it doesn't show any path to being closed: openzfs/zfs#10251

    After reading the issue, especially someone running sudo sync && echo 2 | sudo tee /proc/sys/vm/drop_caches in crontab, I think it is a serious issue that should be fixed by openzfs themselves.

    I don't want to introduce special handling for a out-of-tree module in a common module, and doing it may introduce inconsistant behavior to FreeBSD and Solaris which also use zfs by default.

    I'd rather not do this unless it can fix some issues like #1988

  5. leo60228 commented on Oct 15, 2025

    @leo60228
    Author

    I think the person who needed to automate cleaning the ZFS cache was experiencing an effectively unrelated bug. This is a Linux-specific issue relating to how /proc/meminfo computes MemAvailable that ZFS developers seem to think is intractable to fix without upstream kernel changes.

    While it's not as obviously incorrect as reporting higher memory in-use than total, I don't think claiming a ~idle system has >20GB of RAM usage is any more helpful for getting an accurate picture of the system state.

  6. added a commit that references this issue on Jun 27, 2026
    7f95924
  7. added a commit that references this issue on Jun 28, 2026
    dfdc728
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions