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
Unknown Object (File)
Thu, Apr 18, 6:55 AM
Unknown Object (File)
Dec 20 2023, 7:12 AM
Unknown Object (File)
Dec 20 2023, 4:33 AM
Unknown Object (File)
Nov 13 2023, 1:10 AM
Unknown Object (File)
Nov 10 2023, 12:47 PM
Unknown Object (File)
Nov 5 2023, 2:10 PM
Unknown Object (File)
Oct 10 2023, 12:11 AM
Unknown Object (File)
Oct 9 2023, 11:42 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

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

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 ↗(On Diff #63556)

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 ↗(On Diff #63556)

Why do you check the object type ?

sys/vm/vm_fault.c
726 ↗(On Diff #63556)

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 ↗(On Diff #63556)

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 ↗(On Diff #63556)

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 ↗(On Diff #63556)

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