Page MenuHomeFreeBSD

Use atomics for object reference count so that we can use the shared lock to protect it.
ClosedPublic

Authored by jeff on Sep 10 2019, 8:34 PM.
Tags
None
Referenced Files
F81579819: D21598.diff
Thu, Apr 18, 10:36 AM
Unknown Object (File)
Wed, Apr 17, 7:02 AM
Unknown Object (File)
Mon, Apr 8, 5:29 PM
Unknown Object (File)
Mar 15 2024, 10:30 AM
Unknown Object (File)
Mar 15 2024, 10:30 AM
Unknown Object (File)
Mar 15 2024, 10:30 AM
Unknown Object (File)
Mar 15 2024, 10:17 AM
Unknown Object (File)
Dec 20 2023, 5:01 AM
Subscribers

Details

Summary

This allows for shared locks in some cases where we are manipulating the object reference count.

It would be possible for non-vnode objects to actually atomically drop the reference count with no lock held as long as it is above 2. Callers that expect stable reference counts with the write lock held only require it stay stable below 2. The relationship between the object and vnode reference counts make this much more complex for vnodes. I would like to refactor this so we only bump the vnode ref for the first object ref but it requires other changes to vfs.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jeff added reviewers: alc, kib, markj, dougm.
This revision is now accepted and ready to land.Sep 22 2019, 1:42 PM
sys/vm/vm_object.c
525 ↗(On Diff #61916)

BTW, why do you need the object lock there at all ? The object->type can only migrate from OBJT_VNODE to OBJT_DEAD until we hold the reference.