Page MenuHomeFreeBSD

vm_object: Modify vm_object_allocate_anon() to return OBJT_SWAP objects
ClosedPublic

Authored by markj on Jul 12 2022, 4:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 20 2024, 10:12 PM
Unknown Object (File)
Mar 20 2024, 10:12 PM
Unknown Object (File)
Mar 20 2024, 10:12 PM
Unknown Object (File)
Mar 12 2024, 11:50 PM
Unknown Object (File)
Feb 7 2024, 12:36 AM
Unknown Object (File)
Jan 25 2024, 1:24 AM
Unknown Object (File)
Jan 14 2024, 10:19 AM
Unknown Object (File)
Dec 22 2023, 11:29 PM
Subscribers

Details

Summary

With this change, OBJT_DEFAULT objects are no longer allocated.
Instead, anonymous objects are always of type OBJT_SWAP and always have
OBJ_SWAP set.

Modify the page fault handler to check the swap block radix tree in
places where it checked for objects of type OBJT_DEFAULT. In
particular, there's no need to invoke getpages for an anonymous object
with no swap blocks assigned. It might be that we could relax this to
non-anonymous objects as well (e.g., we could perhaps avoid needlessly
calling getpages during faults on mappings of tmpfs files).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 46382
Build 43271: arc lint + arc unit

Event Timeline

markj requested review of this revision.Jul 12 2022, 4:22 PM
sys/vm/vm_fault.c
235

Why do you require OBJ_ANON there?

sys/vm/vm_fault.c
235

I think it is not strictly required. Just being conservative since the fault handler previously only looked for OBJT_DEFAULT objects, and those are almost always anonymous objects. I think I would relax this check in a separate commit, if at all.

kib added inline comments.
sys/vm/vm_fault.c
235

This is not strictly equivalent to the old condition, anyway.

I see no reason to keep OBJ_ANON.

This revision is now accepted and ready to land.Jul 12 2022, 6:08 PM

In _vm_object_allocate(), initialize swp.writemappings as we do the swap block
tree.

This revision now requires review to proceed.Jul 13 2022, 1:24 PM
sys/vm/vm_fault.c
227

I would replace "does" by "can" because a copy is not certain to exist even if this function returns true.

235

I found the inclusion of OBJ_ANON here to be unexpected and confusing; in other words, it forced me to think. So, I would also argue for removing it.

Elide getpages for all swap objects with no swap blocks assigned, not just anonymous objects.

markj marked 4 inline comments as done.

Tweak the wording of fault_object_needs_getpages()'s comment.

This revision is now accepted and ready to land.Jul 14 2022, 10:03 AM