Page MenuHomeFreeBSD

Move a handful of stack variables into the faultstate.
ClosedPublic

Authored by jeff on Jan 21 2020, 7:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 15, 2:14 PM
Unknown Object (File)
Oct 3 2024, 9:24 PM
Unknown Object (File)
Oct 3 2024, 4:06 PM
Unknown Object (File)
Oct 2 2024, 4:52 PM
Unknown Object (File)
Oct 1 2024, 5:06 PM
Unknown Object (File)
Oct 1 2024, 3:52 PM
Unknown Object (File)
Sep 28 2024, 5:39 PM
Unknown Object (File)
Sep 24 2024, 10:12 AM
Subscribers

Details

Summary

This allows me to split off more functionality into helper routines. I have an 9 patch series that eventually makes:
vm_fault_lookup(), vm_fault_relookup(), vm_fault_allocate(), vm_fault_getpages(), vm_fault_cow(), etc. This allows me to eliminate gotos and make the control flow more clear. It reduces vm_fault() from ~900loc to ~200loc. I have an idea for sendfile on zfs that will require a custom object fault function and moving these parameters into the fault state makes it easier to override later.

The one downside to this approach is that we have to be very careful about what changes to the state persist across restarts. In particular I notice that retry_prot was modifying fault_type permanently. If a restart happened after this it may be incorrect and we could immediately re-trigger the same fault. I have changed this so that fault_type is reloaded on retry but I would like some confirmation that this is the correct thing to do.

vm_fault_soft_fast also modifies vaddr so I make a local copy.

Diff Detail

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

Event Timeline

jeff added reviewers: alc, dougm, kib, markj.
jeff set the repository for this revision to rS FreeBSD src repository - subversion.
This revision is now accepted and ready to land.Jan 21 2020, 8:55 PM

I think reloading fault_type is right. It looks to me like the same bug fixed by r355469.

sys/vm/vm_fault.c
132 ↗(On Diff #67113)

Missing a tab.