git: d2acf0a44709 - main - swap_pager: pctrie_reclaim_cb in meta_free_all
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 13 Jun 2024 18:52:47 UTC
The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=d2acf0a447093dcf0805c75490e1cd989bc8c36c commit d2acf0a447093dcf0805c75490e1cd989bc8c36c Author: Doug Moore <dougm@FreeBSD.org> AuthorDate: 2024-06-13 18:47:54 +0000 Commit: Doug Moore <dougm@FreeBSD.org> CommitDate: 2024-06-13 18:52:25 +0000 swap_pager: pctrie_reclaim_cb in meta_free_all Replace the lookup-remove loop in swp_pager_meta_free_all with a call to SWAP_PCTRIE_RECLAIM_CALLBACK, to eliminate repeated trie searches. Reviewed by: rlibby Differential Revision: https://reviews.freebsd.org/D45583 --- sys/vm/swap_pager.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 3bfda3eea169..c339f70ddea1 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -2220,8 +2220,11 @@ swp_pager_meta_free(vm_object_t object, vm_pindex_t pindex, vm_pindex_t count, } static void -swp_pager_meta_free_block(struct swblk *sb, struct page_range *range) +swp_pager_meta_free_block(void *sbv, void *rangev) { + struct swblk *sb = sbv; + struct page_range *range = rangev; + for (int i = 0; i < SWAP_META_PAGES; i++) { if (sb->d[i] != SWAPBLK_NONE) swp_pager_update_freerange(range, sb->d[i]); @@ -2238,19 +2241,13 @@ swp_pager_meta_free_block(struct swblk *sb, struct page_range *range) static void swp_pager_meta_free_all(vm_object_t object) { - struct swblk *sb; struct page_range range; - vm_pindex_t pindex; VM_OBJECT_ASSERT_WLOCKED(object); swp_pager_init_freerange(&range); - for (pindex = 0; (sb = SWAP_PCTRIE_LOOKUP_GE( - &object->un_pager.swp.swp_blks, pindex)) != NULL;) { - pindex = sb->p + SWAP_META_PAGES; - SWAP_PCTRIE_REMOVE(&object->un_pager.swp.swp_blks, sb->p); - swp_pager_meta_free_block(sb, &range); - } + SWAP_PCTRIE_RECLAIM_CALLBACK(&object->un_pager.swp.swp_blks, + swp_pager_meta_free_block, &range); swp_pager_freeswapspace(&range); }