Page MenuHomeFreeBSD

[wip] extend MNT_VNODE_FOREACH macro with callback argument and use it to filter vnodes for tmpfs mtime
Needs ReviewPublic

Authored by mjg on May 12 2019, 2:02 AM.



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.

Diff Detail

rS FreeBSD src repository
Lint Skipped
Unit Tests Skipped
Build Status
Buildable 24209

Event Timeline

mjg created this revision.May 12 2019, 2:02 AM
mjg edited the summary of this revision. (Show Details)May 12 2019, 7:58 AM
kib added a comment.May 12 2019, 9:22 AM

I do not object against this.

I do not see how could you avoid scanning vnodes, mtime updates from the mmaped writes to the file is the POSIX-mandated feature and users complained about lack of it.


I assume this knob is added only for the measures ?