The nullfs upper vnode adds a use count to a lower vnode. This means that the
lower vnodes cannot be recycled until the uppper one gets recycled. This
behaviour makes a trouble upon the system-wide vnode recycling, eg vnlru and
ZFS.
This commit adds the recycling on the nullfs vnodes, so that the lower vnodes
get released from nullfs and ready for recycling. As of now, the trigger is
the vm_lowmem kernel event.
In order to let some nullfs vnodes remain under the continuous recycling, this
implementation recycles up to the tunable ratio of the recyclable nodes. The
ratio is chosen by the vm_lowmwm flag as follows:
- VM_LOW_PAGES: 20% (sysctl OID: vfs.nullfs.recycle.lowpages)
- VM_LOW_KMEM: 80% (sysctl OID: vfs.nullfs.recycle.lowkmem)
The in-use nullfs vnodes are tracked in the same way as ZFS.
- Tested Case
- poudriere-bulk(8) of 2128 ports by 8 builders.
- Observed Improvements
- The ARC dnode size no longer keeps increasing.
- The vnodes have stopped increasing as well.
- The ARC dnode size tends to decrease during the long-running builds.
- The ARC evictable portion remains throughout the build.
- The data is almost completely evictable.
- New Sysctl(3) OIDs
- vfs.nullfs.nodes The number of the total nullfs vnodes.
- vfs.nullfs.inuse The number of the nullfs vnodes in use.
- vfs.nullfs.recycle.calls The number of the nullfs recycle execution requests.
- vfs.nullfs.recycle.lowpages The ratio of the nullfs vnodes recycled by the VM_LOW_PAGES vm_lowmem kernel event.
- vfs.nullfs.recycle.lowkmem The ratio of the nullfs vnodes recycled by the VM_LOW_KMEM vm_lowmem kernel event.
PR: 275594
Security: FreeBSD-EN-23:18.openzfs
Signed-off-by: Seigo Tanimura <seigo.tanimura@gmail.com>