From nobody Mon Aug 08 03:22:02 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M1M226FJMz4YjXQ; Mon, 8 Aug 2022 03:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M1M225rkFz44Lj; Mon, 8 Aug 2022 03:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659928922; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=swVx8wyW4VdRgCPU3dmQ4dtgOKNRltLcNOiZnyXVdsk=; b=RnsVfZp7+p6O0SajZvx70HYNUnRfiJlOrVO0WUejYHFS1IfBiZcqv1KrRHiHfiLxRky+ad 3tgQhsaNcZ1zmo2NCMyP7kBYCQHX3rcUp1VLGaCUFNmIe/qqM76rUSnHXsgYMHV3ZafTo1 WIR9Blo8bDiWFp2TcBCNoSE+z7FEfvgbDh+0soREKeG3y8cgMlDcwe7YEM8LVP++u1uMtQ CsIdtUKD02/esia4nFmzgYE+Tn724dfhqMJcA8dtHiKEayEw2ZLG6nxv1FT2+JzMut+SCu v3GnMpcbBb2vbtaKiiT8X9oH4f44uR/V3JP61Iinp5N1PIZ+i87eQigddS1M0g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M1M224w6lzcmF; Mon, 8 Aug 2022 03:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2783M2Tu017622; Mon, 8 Aug 2022 03:22:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2783M2Rl017621; Mon, 8 Aug 2022 03:22:02 GMT (envelope-from git) Date: Mon, 8 Aug 2022 03:22:02 GMT Message-Id: <202208080322.2783M2Rl017621@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Doug Moore Subject: git: 02e43a0d0594 - stable/13 - swap_pager: Reduce the scope of the object lock in putpages List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dougm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 02e43a0d059446a643be82f44e59dc789db94ebe Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659928922; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=swVx8wyW4VdRgCPU3dmQ4dtgOKNRltLcNOiZnyXVdsk=; b=jvoJP6KSWNbUgW3oZ2Rq29FgfUK1hK1Rh01I5xlejSsLW5J3wQOHB1omJ0arw55TgBZcVX JtjGf8m1c4Q+fNjQQiJAvzdLDBWiObo/MkvB7m3M3NYLiItC8GTEDSZH1In6JJt7kBBNnZ tqKyqynq8mj5nxvikmEy4GKS8kNZ8Bz+vIpD9atMusR5+TINCdtaWLY/KinVZSwnb7+t7R LF1S5NFct7a+GJ24CBWEz/C/6W5RUvXGvqCRU9I8YqL6LrX+RP+lEPsUlS1MRp2ghT4NBm Zl2p4axZntnV2mdSG/m3avvNB/SfIVCRYItJTe6HoXRHAMEyeC4S3ltIZvpJ9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659928922; a=rsa-sha256; cv=none; b=EbHDaea3zHJIIUC7WKt769bGakjeXjouHkjN/Q8z+VklkzZxb0MtDUL9Psx7xBAHryamum X/b8OqmroyS6s6ukEQxZii85Qn6nNb/8v0kjHezR2ittx22T5Y7lzVY/TodXV95tBRAp3s bhAS/g2L9RlHMly/rtn7iQOTePBOnBX8V4KIj/9D5dEoAF4iExMI8PbAZh/AxOOrQEZUTP 85QwGqktzcHpHovh69sOgoDcwtuDu94oi3elLKZKWv9ti7XrjRsoDsxz7TyQjNeGayJ0NH HeXRqLTojjeJ/53NZ2ELYw60f7mt4vTl7Wiu5y3KbiIlMTormS5LaWNDamUGyg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=02e43a0d059446a643be82f44e59dc789db94ebe commit 02e43a0d059446a643be82f44e59dc789db94ebe Author: Alan Cox AuthorDate: 2022-07-19 03:28:07 +0000 Commit: Doug Moore 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);