If 'kern.maxfilesperproc' is greater than 'kern.maxvnodes' (and
'kern.maxfiles' is also), one process can eat up all available vnodes in
the system, bringing it to a halt. In fact, multiple processes can have
the same effect as long as 'kern.maxfiles' is greater than
'kern.maxvnodes'.
In practice, I observed such a thing happening with KDE's Baloo on
a machine with 64GB of RAM, where the automatic tuning sets
'kern.maxfiles' higher than 'kern.maxvnodes'. This has apparently also
occured to other people recently (see, e.g.,
https://lists.freebsd.org/archives/freebsd-hackers/2025-March/004372.html).
A thorough analysis of the current automatic tuning shows that the
default for 'kern.maxfiles' exceeds that for 'kern.maxvnodes' when the
physical memory exceeds ~5136MB.
In advance of revising the automatic tuning, but also to support setting
manually these two parameters while avoiding this
non-immediately-obvious footshooting, make sure that 'kern.maxfiles' can
never exceed 'kern.maxvnodes'. In fact, make sure 'kern.maxvnodes' is
always larger by some leeway (default: 1000, sysctl knob
'debug.vnodes_to_files_leeway').