giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.08k stars 1.37k forks source link

feat: add virtual memory compatibility for zfs arc architectures #2385

Open hewdoe opened 3 months ago

hewdoe commented 3 months ago

Summary

Description

On Linux-based OS's, /proc/meminfo does not report memory consumption by the ZFS ARC disks. It's my understanding that this memory is reclaimable. These changes include what "htop" deems "shrinkable" memory into the used, cached and available memory totals, which solved an issue on one of my systems which was over-reporting memory consumption.

Here are a few resources: https://www.reddit.com/r/zfs/comments/ha0p7f/understanding_arcstat_and_free/ https://github.com/openzfs/zfs/issues/10255

Please note: Throughout the function I edited, there's many references to the outputs behaving like the "free" CLI tool. This change will make the output behave as "htop" does instead, so if this is undesired please feel free to reject or further decouple this implementation

Please let me know if this is relevant or not and I can add a test and make changes to the readTheDocs Documentation too. Just not necessary at the moment for me if this will only ever be used on my fork