Skip to content

freebsd: Support laundry memory and ZFS ARC

FreeBSD 11.1 removes cache memory and adds laundry memory. The MIB of cache memory still exists, but its value is always set to zero. According to the man page of top(1), the value of laundry memory means number of dirty pages queued for laundering, suggesting that it should be added to the 'user' in libgtop because it cannot be freed immediately without writing out data. Laundry memory was part of inactive memory in older FreeBSD releases.

FreeBSD systems running on ZFS usually have a large portion of memory used as ZFS ARC, which has similar purpose to buffer cache of other filesystems. ZFS ARC can usually be freed quickly when the system needs more memory, so we don't want to put it in 'user' in libgtop. However, both buffer cache and ZFS ARC are parts of wired memory, and wired memory is counted in 'user'. Therefore, we subtract the size of ZFS ARC from wired memory when calculating 'user' value, making it more useful to FreeBSD users.

This patch is based on the patch submiited three years ago by Benoît Dejean bdejean@gmail.com.

https://bugzilla.gnome.org/show_bug.cgi?id=748928 #31

If you need more information on FreeBSD memory classes in order to review the patch, there is an article on FreeBSD wiki: https://wiki.freebsd.org/Memory. Unfortunately, it seems to me that it is impossible to get the accurate number for libgtop 'user' memory because both active and inactive memory contain a mix of clean and dirty pages.

Merge request reports