https://github.com/zfsonlinux/zfs/pull/6989 needs to be merged from ZoL. I originally disregarded it myself due to very small size of dbuf cache, but since its size increased recently, it should become more important for proper buffers promotion MRU to MFU. I've tried that patch on FreeBSD and it does what it declares.
Description When the compressed ARC feature was added in commit d3c2ae1 the method of reference counting in the ARC was modified. As part of this accounting change the arc_buf_add_ref() function was removed entirely. This would have been fine but the arc_buf_add_ref() function served a second undocumented purpose of updating the ARC access information when taking a hold on a dbuf. Without this logic in place a cached dbuf would not migrate its associated arc_buf_hdr_t to the MFU list. This negatively impacts the ARC hit rate, particularly on systems with a small ARC. This change reinstates the missing call to arc_access() from dbuf_hold() by implementing a new arc_buf_access() function. Motivation and Context As reported in #6171 a significant drop in the ARC hit rate was reported by users upgrading to the 0.7.x releases. How Has This Been Tested? Manually with the following trivial test case which reads a file twice. After the first read the file size should be reflected in the arcstat mru_size. After the second read the file size should have been migrated to the arcstat mfu_size. Notice that when testing without the patch the mfu_size doesn't increase on the second read. $ zfs mount -a $ grep -E 'mru_size|mfu_size' /proc/spl/kstat/zfs/arcstats mru_size 4 412672 mfu_size 4 739328 $ cat /tank/file >/dev/null grep -E 'mru_size|mfu_size' /proc/spl/kstat/zfs/arcstats mru_size 4 21483008 mfu_size 4 786432 $ cat /tank/file >/dev/null grep -E 'mru_size|mfu_size' /proc/spl/kstat/zfs/arcstats mru_size 4 21483008 mfu_size 4 786432 After applying this patch the behavior is once again as expected. This matches the long standing behavior from the zfs-0.6.5.x releases. $ zfs mount -a $ grep -E 'mru_size|mfu_size' /proc/spl/kstat/zfs/arcstats mru_size 4 415232 mfu_size 4 737792 $ cat /tank/file >/dev/null $ grep -E 'mru_size|mfu_size' /proc/spl/kstat/zfs/arcstats mru_size 4 21384192 mfu_size 4 889856 $ cat /tank/file >/dev/null $ grep -E 'mru_size|mfu_size' /proc/spl/kstat/zfs/arcstats mru_size 4 1084928 mfu_size 4 21198336 Additional testing included a full local run of the ZTS. You can view, comment on, or merge this pull request online at: https://github.com/openzfs/openzfs/pull/606 -- Commit Summary -- * 9433 Fix ARC hit rate -- File Changes -- M usr/src/uts/common/fs/zfs/arc.c (52) M usr/src/uts/common/fs/zfs/dbuf.c (4) M usr/src/uts/common/fs/zfs/sys/arc.h (1) -- Patch Links -- https://github.com/openzfs/openzfs/pull/606.patch https://github.com/openzfs/openzfs/pull/606.diff -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/openzfs/openzfs/pull/606 ------------------------------------------ openzfs: openzfs-developer Permalink: https://openzfs.topicbox.com/groups/developer/discussions/T9235f754de980785-M03c62eb5d5f10c973bf3e755 Delivery options: https://openzfs.topicbox.com/groups