Page MenuHomeFreeBSD

Don't update per-page activation counts in the swapout code.
ClosedPublic

Authored by markj on Dec 4 2019, 4:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 4:33 PM
Unknown Object (File)
Mon, Oct 28, 11:56 PM
Unknown Object (File)
Oct 16 2024, 1:35 PM
Unknown Object (File)
Oct 8 2024, 8:22 PM
Unknown Object (File)
Oct 8 2024, 12:10 AM
Unknown Object (File)
Oct 2 2024, 5:46 AM
Unknown Object (File)
Sep 19 2024, 7:31 PM
Unknown Object (File)
Sep 17 2024, 9:44 AM
Subscribers

Details

Summary

This is the work of the page daemon. Now that the page daemon does slow
and steady scanning of the active queue, I don't think it makes much
sense to replicate that algorithm here. Moreover, it was doing so
inconsistently:

  • PGA_REFERENCED is not counted in act_count unless pmap_ts_referenced() returned 0, but the page daemon always counts PGA_REFERENCED.
  • The swapout daemon always activates a referenced page, but the page daemon only does so when the containing object is mapped at least once.

The main purpose of swapout_deactivate_pages() is to shrink the number
of pages mapped into a given pmap. To do this without unmapping active
pages, use the non-destructive pmap_is_referenced() instead of the
destructive pmap_ts_referenced() and deactivate pages accordingly.

This function is racy before and after this change: a reference bit
which is set between the pmap_is_referenced() and
vm_page_try_remove_all() calls is lost. We do not have a pmap interface
for removing only unreferenced mappings.

Diff Detail

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

Event Timeline

Re-add page locking which I removed prematurely.

kib added inline comments.
sys/vm/vm_swapout.c
183 ↗(On Diff #65275)

Does it make sense to move these checks before tryxbusy() ? Same for pmap_is_referenced() call below ?

This revision is now accepted and ready to land.Dec 6 2019, 3:00 PM
sys/vm/vm_swapout.c
183 ↗(On Diff #65275)

The wired check must come after the busy (the holder of a page busy is allowed to wire the page), but otherwise I think this is reasonable.

sys/vm/vm_swapout.c
183 ↗(On Diff #65275)

I suspect that the checks should be repeated after xbusy succeeded. At least exists_quick(), and then wired().

sys/vm/vm_swapout.c
183 ↗(On Diff #65275)

What are you trying to save by reordering?

sys/vm/vm_swapout.c
183 ↗(On Diff #65275)

I want to execute tests that do not change the page' state before we modify the page (xbusy). I do think that in some situations the page_exists_quick() or wired() checking before xbusy would save a lot.

sys/vm/vm_swapout.c
183 ↗(On Diff #65275)

page_exists_quick() is still much more expensive than busy. If we have to repeat it it seems like a loss to me. busy is only an atomic. For wired you could check before and after with little cost.

sys/vm/vm_swapout.c
183 ↗(On Diff #65275)

I think we could check wired and exists_quick() before busy, and repeat the wired check after. I think the exists_quick() check is probably too expensive to repeat.

Check for wirings before busying the page.

This revision now requires review to proceed.Dec 9 2019, 8:36 PM
This revision is now accepted and ready to land.Dec 9 2019, 11:04 PM