git: 02e43a0d0594 - stable/13 - swap_pager: Reduce the scope of the object lock in putpages
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 08 Aug 2022 03:22:02 UTC
The branch stable/13 has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=02e43a0d059446a643be82f44e59dc789db94ebe commit 02e43a0d059446a643be82f44e59dc789db94ebe Author: Alan Cox <alc@FreeBSD.org> AuthorDate: 2022-07-19 03:28:07 +0000 Commit: Doug Moore <dougm@FreeBSD.org> CommitDate: 2022-08-08 03:16:10 +0000 swap_pager: Reduce the scope of the object lock in putpages We don't need to hold the object lock while allocating swap space, so don't. Reviewed by: dougm, kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D35839 (cherry picked from commit 54291f7d6506e6c6087433c5bbdb2224b6cef23b) --- sys/vm/swap_pager.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 59d996492b90..394058b8ccea 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -1514,10 +1514,8 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count, } /* Get a block of swap of size up to size n. */ - VM_OBJECT_WLOCK(object); blk = swp_pager_getswapspace(&n); if (blk == SWAPBLK_NONE) { - VM_OBJECT_WUNLOCK(object); mtx_lock(&swbuf_mtx); if (++nsw_wcount_async == 1) wakeup(&nsw_wcount_async); @@ -1526,6 +1524,7 @@ swap_pager_putpages(vm_object_t object, vm_page_t *ma, int count, rtvals[i + j] = VM_PAGER_FAIL; continue; } + VM_OBJECT_WLOCK(object); for (j = 0; j < n; ++j) { mreq = ma[i + j]; vm_page_aflag_clear(mreq, PGA_SWAP_FREE);