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)
Tue, Dec 10, 7:20 AM
Unknown Object (File)
Fri, Dec 6, 10:59 AM
Unknown Object (File)
Wed, Nov 27, 11:43 PM
Unknown Object (File)
Thu, Nov 21, 9:58 PM
Unknown Object (File)
Oct 10 2024, 10:17 PM
Unknown Object (File)
Sep 16 2024, 7:54 PM
Unknown Object (File)
Sep 15 2024, 6:44 PM
Unknown Object (File)
Sep 4 2024, 5:49 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