Page MenuHomeFreeBSD

Make page busy state deterministic on free. Pages associated with objects must be xbusy on free. Pages not associated with objects must not be busy.
ClosedPublic

Authored by jeff on Dec 15 2019, 2:53 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 5, 1:31 AM
Unknown Object (File)
Wed, Nov 27, 11:31 AM
Unknown Object (File)
Sun, Nov 24, 2:19 PM
Unknown Object (File)
Sun, Nov 24, 2:14 PM
Unknown Object (File)
Fri, Nov 22, 1:25 PM
Unknown Object (File)
Oct 3 2024, 11:29 PM
Unknown Object (File)
Oct 3 2024, 8:51 PM
Unknown Object (File)
Oct 2 2024, 6:35 PM
Subscribers

Details

Summary

This closes the loop on xbusy protecting page identity. It makes lockless lookup much cleaner because I don't have to worry about code saying if (busy) unbusy(). Because busy does not have a strong ownership concept you can unlock another threads lock. As you can see very few changes were required to make the busy state consistent at this point.

I personally think the vm_page_replace() API is cleaner now. It is effectively always _checked(). We don't strictly need a pindex argument although in some cases it does provide for an additional assert.

It is not absolutely necessary that I assert the state but I prefer the stronger guarantee this gives. In the future it may provide an avenue to resolve the NOFREE flag on vm objects.

Test Plan

passes stress2

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 28160
Build 26294: arc lint + arc unit

Event Timeline

jeff retitled this revision from Make page busy state deterministic on free. Pages associated with objects must be xbusy on free. Pages not associated with objects must not be busy. to Make page busy state deterministic on free. Pages associated with objects must be xbusy on free. Pages not associated with objects must not be busy..Dec 15 2019, 3:06 AM
jeff edited the summary of this revision. (Show Details)
jeff edited the test plan for this revision. (Show Details)
jeff added reviewers: alc, dougm, kib, markj.
jeff set the repository for this revision to rS FreeBSD src repository - subversion.
sys/dev/xen/gntdev/gntdev.c
834

Is mres == NULL possible?

sys/dev/xen/privcmd/privcmd.c
178

I don't know if mres == NULL is even possible?

sys/vm/vm_fault.c
1258

Instead of adding vm_page_remove_hold(), which has no other callers, can we wrap all of this into a single function? I don't really like the direct manipulation of the reference count.

sys/vm/vm_kern.c
589

Can we require that one of VM_ALLOC_{NOWAIT,WAITOK,WAITFAIL} be specified? I find this KPI very confusing otherwise.

sys/vm/vm_page.c
1623

This is just vm_page_remove_hold().

2796

Why can't we use vm_page_replace() here? We know that there are no other references to the page.

3921

I will fix this.

sys/dev/xen/gntdev/gntdev.c
834

I suspect not.

sys/vm/vm_fault.c
1258

I find vm_page_remove_hold() existence quite logical. I.e., even if these three calls are wrapped into a helper, remove_hold() is still quite understandable standalone piece of code.

Change semantics so that vm_page_drop is exposed in fewer places.

This revision is now accepted and ready to land.Dec 21 2019, 9:33 PM
sys/vm/vm_kern.c
589

I would eventually like to require a busy state, yes. But that is for a later diff.