Page MenuHomeFreeBSD

2/3 vfs: allow v_usecount to transition 0->1 without the interlock
ClosedPublic

Authored by mjg on Jan 15 2020, 3:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 29, 1:08 AM
Unknown Object (File)
Dec 21 2023, 3:45 AM
Unknown Object (File)
Nov 25 2023, 8:51 PM
Unknown Object (File)
Nov 12 2023, 10:49 AM
Unknown Object (File)
Nov 12 2023, 9:06 AM
Unknown Object (File)
Oct 20 2023, 9:46 AM
Unknown Object (File)
Sep 6 2023, 2:49 AM
Unknown Object (File)
Jul 5 2023, 2:47 PM
Subscribers

Details

Summary

There is nothing to do but to bump the count even during said transition. There are 2 places which can do it:

  • vget only does this after locking the vnode, meaning there is no change in contract versus inactive or reclamantion
  • vref only ever did it with the interlock held which did not protect against either (that is, it would always succeed)

VCHR vnodes retain special casing due to the need to maintain dev use count.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 28675

Event Timeline

mjg retitled this revision from vfs: allow v_usecount to transition 0->1 without the interlock to 2/3 vfs: allow v_usecount to transition 0->1 without the interlock.Jan 15 2020, 3:01 AM
jeff added inline comments.
sys/kern/vfs_subr.c
2894

Do you think we should also noinline these? or is predict_false enough to prevent it?

2958

refcount_ actually will give you the old value now.

This revision is now accepted and ready to land.Jan 17 2020, 11:55 PM
sys/kern/vfs_subr.c
2894

It's not guaranteed to prevent inlining hence the other variant is annotated. Must have forgotten somehow skipped this one, will patch later.

2958

refcount API got abused with avoidable extensions which in part prevent adding flags to counts used by vfs. it is slowly moving towards atomic-only use. One flag for use later would be indication that inactive processing is needed plugged into usecount.

sys/kern/vfs_subr.c
2958

Well the rest of us didn't consider it abuse.

I would either use all refcount or none but mixing and matching is going to be problematic.

sys/kern/vfs_subr.c
2958

Well the rest of us didn't consider it abuse.

Pre-exisitng users don't need and it added branches they have no use for.

I would either use all refcount or none but mixing and matching is going to be problematic.

The code is increasingly moving towards pure atomics. What's missing for a complete switch is change if not zero et al which will be added later.