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)
Dec 22 2023, 9:45 PM
Unknown Object (File)
Dec 20 2023, 1:21 AM
Unknown Object (File)
Dec 8 2023, 1:13 AM
Unknown Object (File)
Sep 18 2023, 5:43 AM
Unknown Object (File)
Sep 18 2023, 5:41 AM
Unknown Object (File)
Sep 3 2023, 1:25 AM
Unknown Object (File)
Aug 28 2023, 4:58 AM
Unknown Object (File)
May 14 2023, 6:47 PM
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.