Page MenuHomeFreeBSD

Replace OBJ_MIGHTBEDIRTY with a system using atomics. Remove theTMPFS_DIRTY flag to simplify set_writeable_dirty().
ClosedPublic

Authored by jeff on Oct 22 2019, 10:02 PM.
Tags
None
Referenced Files
F137746013: D22116.id63766.diff
Tue, Nov 25, 10:29 AM
F137616074: D22116.id63556.diff
Mon, Nov 24, 3:24 PM
Unknown Object (File)
Sun, Nov 23, 5:17 AM
Unknown Object (File)
Thu, Nov 20, 11:35 PM
Unknown Object (File)
Thu, Nov 20, 11:27 PM
Unknown Object (File)
Thu, Nov 20, 11:27 PM
Unknown Object (File)
Thu, Nov 20, 11:23 PM
Unknown Object (File)
Wed, Nov 19, 8:50 AM
Subscribers

Details

Summary

This replaces the MIGHTBEDIRTYFLAG with a 'cleangeneration' counter. This allows us to use an atomic to update 'generation' without touching the flag field. If cleangeneration != generation the object might be dirty.

Remove the object flag for TMPFS_DIRTY and re-use this mechanism directly to avoid the vnode type checks. object_page_clean() won't do anything for tmpfs so it will not reset cleangeneration.

With this in place more cases of vm_fault_dirty can work with a read object lock. I'm least certain about my changes to the vm_fault_soft_fast() callsite and vm_fault_dirty().

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27159
Build 25431: arc lint + arc unit

Event Timeline

jeff retitled this revision from Replace OBJ_MIGHTBEDIRTY with a system using atomics. Remove the TMPFS_DIRTY flag to simplify set_writeable_dirty(). to Replace OBJ_MIGHTBEDIRTY with a system using atomics. Remove theTMPFS_DIRTY flag to simplify set_writeable_dirty()..Oct 22 2019, 10:08 PM
jeff edited the summary of this revision. (Show Details)
jeff added reviewers: kib, markj, alc, dougm.

One last point; it would be trivial to turn generation into a timestamp so that it could be used for more precise mtime without needing periodic polling.

sys/vm/vm_fault.c
726

This was a microoptimization to avoid taking vm object lock shared when we cannot do a useful work with that lock.

sys/vm/vm_object.c
821

Why do you check the object type ?

sys/vm/vm_fault.c
726

I'm not sure I understand then. I made it possible to set mightbedirty with the shared lock. We should now be able to proceed here.

sys/vm/vm_object.c
821

This is leftover from another version of the patch that did not check it in vm_object_mightbedirty(). I will fix that.

sys/vm/vm_fault.c
726

I meant that this was the reason for recheck under the lock, or rather, a reason to first do the checks without the lock held. I did not requested a change there.

sys/vm/vm_fault.c
726

Ok understood. If you accept the general scheme can you approve?

This revision is now accepted and ready to land.Oct 25 2019, 6:57 AM