Note this is just a proposal.
Currently tmpfs scans the entire vnode list looking for potential vnodes which need the update. When running with poudriere this translated to hundreds of thousands of vnodes scanned per second due to hundreds of mount points. While not doing it in the first place would be best, what follows is a simple bandaid.
At the very least the code can be augmented to pre-filter vnodes without taking the interlock. Checking with dtrace reveals there almost no vnodes need the treatment, thus this avoids a lot of locking.
I think this is perfectly safe since vm objects are type-stable. A cast through volatile read is performed to make sure the pointer is only read once.
One thing which may need to be improved here is the total lock hold time. Perhaps it can be relocked every n vnodes or if should_yield indicates it.