This fix essentially eliminates the high CPU usage caused by the ARC pruning
thread, acknowledged by FreeBSD-EN-23:18.openzfs.
- Key Features
- Accounting of the ZFS vnodes in use. (v_usecount > 0)
- Recycling of the ZFS vnodes with the precise target.
- Acceleration of the ZFS vnode recycling by the ARC eviction waiters.
- Tested Case
- poudriere-bulk(8) of 2128 ports by 8 builders.
- Observed Improvements
- The CPU usage of kernel{arc_prune} no longer sticks to 100%.
- There are still occasional surges.
- The vnode operations are now more smooth.
These improvements are achieved in ZFS and partly VFS.
- Remaining Issues
- The ARC dnode size stays high during the build.
- The ARC evictable sizes fall to zero on all states and types. (data, metadata)
These are due to the use of nullfs over ZFS. They are fixed by a separate
commit.
- New Sysctl(3) OIDs
- vfs.zfs.arc.vm_lowmem.event The number of the vm_lowmem kernel events.
- vfs.zfs.arc.vm_lowmem.kmem The number of the VM_LOW_KMEM vm_lowmem kernel events.
- vfs.zfs.arc.vm_lowmem.pages The number of the VM_LOW_PAGES vm_lowmem kernel events.
- vfs.zfs.arc.vm_lowmem.nofree The number of the failures to release the ARC memory.
- vfs.zfs.arc.vm_lowmem.pagedaemon The number of the ARC memory release run by a pagedaemon kernel thread.
- vfs.zfs.znode.count The number of the total ZFS vnodes.
- vfs.zfs.znode.inuse The number of the ZFS vnodes in use.
- vfs.zfs.znode.prunable The number of the recyclable ZFS vnodes.
- vfs.zfs.znode.pruning_requested The number of the ARC pruning requests.
- vfs.zfs.znode.pruning_skipped The number of the ARC pruning requests skipped because the kernel does not have the sufficient recyclable ZFS vnodes.
- vfs.zfs.znode.pruning_withwaiter The number of the ARC pruning accelerated becasue of the ARC eviction waiters.
- vfs.zfs.znode.pruning_withwaiter_throttled The number of the ARC pruning throttled despite the ARC eviction waiters.
- vfs.vnode.vnlru.recycle_bufs_pages The toggle to recycle the vnodes with the clean buffers and clean/dirty VM pages.
- default: true
- vfs.vnode.vnlru.recycle_nc_src The toggle to recycle the vnodes acting as namecache source.
- default: true
PR: 275594
Security: FreeBSD-EN-23:18.openzfs
Signed-off-by: Seigo Tanimura <seigo.tanimura@gmail.com>