-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Function swap_pager_swapoff_object calls vm_pager_unswapped (via swp_pager_force_dirty) for every page that must be unswapped. That means that there's an unneeded check for lock ownership (the caller always owns it), a needless PCTRIE_LOOKUP (the caller has already found it), a call to free one page of swap space only, and a check to see if all blocks are empty, when the caller usually knows that the check is useless. Isolate the essential part, needed however swap_pager_unswapped is invoked, into a smaller function swap_pager_unswapped_acct. From swapoff_object, invoke swp_pager_update_freerange for each appropriate page, so that there are potentially fewer calls to swp_pager_freeswapspace. Consider freeing a set of blocks (a struct swblk) only after having invalidated all those blocks. Replace the doubly-nested loops with a single loop, and refetch and rescan a swblk only when the object write lock has been released and reacquired. After getting a page from swap, dirty it immediately to address a race condition observed by @kib. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D45668
- Loading branch information
Doug Moore
authored and
Doug Moore
committed
Jun 27, 2024
1 parent
14fee53
commit 995730a
Showing
1 changed file
with
103 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters