Page MenuHomeFreeBSD

vfs: vntblinit(): Raise default 'kern.maxvnodes' higher than 'kern.maxfiles'
ClosedPublic

Authored by olce on May 12 2025, 7:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 14, 5:26 AM
Unknown Object (File)
Sun, Jun 8, 4:56 PM
Unknown Object (File)
Thu, Jun 5, 10:13 AM
Unknown Object (File)
Tue, Jun 3, 5:19 PM
Unknown Object (File)
Mon, Jun 2, 11:58 PM
Unknown Object (File)
Sat, May 31, 10:33 PM
Unknown Object (File)
Wed, May 28, 2:23 PM
Unknown Object (File)
Sun, May 25, 3:43 AM

Details

Summary

Having 'kern.maxvnodes' higher than 'kern.maxfiles' mitigates a scenario
where some processes can eat up all vnodes in the system, causing
a deadlock, as long as the kernel itself does not create too many vnodes
without creating some file descriptor in some process' FD table. A very
small percentage (~0.6%) of excess vnodes at infinity, coupled with
a large difference near the origin, should cover basic cases more than
enough. Note however that this measure can be defeated, e.g., by using
nullfs mounts with non-trivial file hierarchies.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

olce requested review of this revision.May 12 2025, 7:04 PM

An alternative to D50125 and D50311. Given the current automatic tuning numbers, though, I don't think raising the number of vnodes is necessary, I'd go for D50311 (lowering kern.maxfiles) rather than this one, as I suspect it is well enough for today's machines and software. The change here is just the most conservative, while ensuring that the number of files remains lower then the number of vnodes by default (but here, contrary to D50125, the administrator is still free to override that).

This revision was not accepted when it landed; it landed in state Needs Review.May 15 2025, 3:57 PM
This revision was automatically updated to reflect the committed changes.