Page MenuHomeFreeBSD

Break down swap_pager_swapoff function into small functions.
ClosedPublic

Authored by ota_j.email.ne.jp on Jun 7 2019, 1:08 AM.

Details

Summary

Originally in D13484.
Simpler code refactoring is taken out from sensitive changes.

swp_pager_force_dirty() and swp_pager_force_launder() out of swp_pager_force_pagein().
swap_pager_swapoff_object() out of swap_pager_swapoff()

Test Plan

Regresssion - no functionality changes.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

dougm added inline comments.Jun 7 2019, 2:28 AM
sys/vm/swap_pager.c
1657 ↗(On Diff #58336)

This is an extra wakeup, after the wakeup in the caller.

1673 ↗(On Diff #58336)

Another duplicate wakeup.

1738 ↗(On Diff #58336)

No need to wrap this line to fit in 80 columns.

Move vm_object_pip_wakeup() and vm_pager_page_unswapped() back to swp_pager_force_pagein().

These 2 functions will be adjusted to handle multiple pages in D13484.

alc accepted this revision.Jun 8 2019, 4:44 PM
This revision is now accepted and ready to land.Jun 8 2019, 4:44 PM
kib accepted this revision.Jun 8 2019, 5:41 PM
kib added inline comments.
sys/vm/swap_pager.c
1736 ↗(On Diff #58350)

I believe that the patch is fine, but looking at it, I realized that swp_pager_force_pagein()->swap_pager_getpages() drops vm_object lock, which IMO allows sb to become invalid pointer. And even the busy state of the page around the unlock is not enough IIMO.

This revision was automatically updated to reflect the committed changes.