Page MenuHomeFreeBSD

vm_page_replace: remove redundant radix lookup
ClosedPublic

Authored by rlibby on Dec 9 2015, 4:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Aug 19, 6:42 AM
Unknown Object (File)
Aug 11 2024, 4:18 PM
Unknown Object (File)
Aug 1 2024, 2:29 PM
Unknown Object (File)
Jul 29 2024, 4:24 PM
Unknown Object (File)
Jul 18 2024, 2:20 AM
Unknown Object (File)
Jul 10 2024, 1:55 AM
Unknown Object (File)
Jun 23 2024, 10:12 PM
Unknown Object (File)
Jun 13 2024, 4:36 AM
Subscribers

Details

Summary

Remove redundant lookup of the old page from vm_page_replace.
Verification that the old page exists is already done by
vm_radix_replace.

Follow up from D4326.

Test Plan

kyua test -k /usr/tests/sys/Kyuafile

Diff Detail

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

Event Timeline

rlibby retitled this revision from to vm_page_replace: remove redundant radix lookup.
rlibby updated this object.
rlibby edited the test plan for this revision. (Show Details)
kib edited edge metadata.
kib added inline comments.
sys/vm/vm_page.c
1346 ↗(On Diff #10981)

This shouldn't matter, since the object is locked, but still I would prefer to have unbusy happens after the old page is removed from the object queue.

This revision is now accepted and ready to land.Dec 9 2015, 4:57 PM
rlibby edited edge metadata.

vm_page_replace: remove from tailq before null'ing object

Restore the original sequence of tailq removal and object NULLing. It
makes sense to operate on the listq while object is not NULL since
listq is supposed to be protected by the object lock of the page.

We are of course still operating without page locks.

This revision now requires review to proceed.Dec 9 2015, 5:01 PM
rlibby added inline comments.
sys/vm/vm_page.c
1350 ↗(On Diff #10985)

Yeah, realized the same and made the change.

kib edited edge metadata.
This revision is now accepted and ready to land.Dec 9 2015, 5:26 PM
sys/vm/vm_page.c
1345 ↗(On Diff #10985)

How about: "Keep the resident page list in sorted order." That would better explain why we do the replacement this way.

rlibby edited edge metadata.
rlibby marked an inline comment as done.

vm_page_replace: alc feedback: fixup comment

This revision now requires review to proceed.Dec 9 2015, 5:35 PM
rlibby added inline comments.
sys/vm/vm_page.c
1345–1346 ↗(On Diff #10989)

Fixed up comment as suggested.

alc edited edge metadata.
In D4471#94059, @rlibby_gmail.com wrote:

vm_page_replace: remove from tailq before null'ing object

Restore the original sequence of tailq removal and object NULLing. It
makes sense to operate on the listq while object is not NULL since
listq is supposed to be protected by the object lock of the page.

We are of course still operating without page locks.

For the current set of callers, the page lock doesn't matter. I'd propose that you develop the patch for vm_fault() next, and I'll think about the page locking in the meantime.

This revision is now accepted and ready to land.Dec 9 2015, 5:51 PM
In D4471#94108, @alc wrote:
In D4471#94059, @rlibby_gmail.com wrote:

We are of course still operating without page locks.

For the current set of callers, the page lock doesn't matter. I'd propose that you develop the patch for vm_fault() next, and I'll think about the page locking in the meantime.

Okay, will do. The patch to vm_fault_hold itself should be pretty straightforward, but it should be gated by our confidence in the correctness of vm_page_replace.

With respect to the page locking, I think we would at least not be introducing any regressions if we make vm_page_replace do what vm_page_insert and vm_page_remove do, which is unlocked for insert, and locked for remove of a managed page.

Incidentally, in vm_page_remove, the xbusy state of the page is handled but not required. And, for what it's worth, internally Isilon has a couple callers of vm_page_replace that are xbusy'ing the page solely to satisfy the interface (related to zero-copy and copy-on-write implementations).

This revision was automatically updated to reflect the committed changes.