From nobody Tue Jul 19 03:36:19 2022 X-Original-To: dev-commits-src-main@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 4Ln4Hl4nXjz4Wq31; Tue, 19 Jul 2022 03:36:19 +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 4Ln4Hl4DJtz3V54; Tue, 19 Jul 2022 03:36:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658201779; 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=fhDZK2H7oZGpp9Qvnx2Ft0yOXfxhx+FmNmUWiOwvPR0=; b=OtkqothbptHoi/TRkar22zGXnv7zaseGp7Lj7hC0OIMCr3saJ4ckkpF/IpJT6+NHUK1FyZ CKxMmOAtwp9y0EFr10sxVYlkI7ngbQC8c5vspY5IjtZd0zRhxA6ZAFB4pskVqZDnO/3pHv E4Wh5YsiOFe/CaZqQuL1ucSuHPpYv/4X9mLMUfuYaqCub2bbliCVZGTzyDr8YFb2EUYtd1 dsf7QGm6n9OF6+BRgzfaXasN8Or72aMemrO3RWkVQS43UxsOkDSDnxaSSvo9ktLcaBRgCd L4VtT8yFAV+djfMo2gc/FoR6yAfUwrDiaK5V8ewkWYs13bg3Oae8uXGk7aHr0Q== 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 4Ln4Hl3DsTz14Lv; Tue, 19 Jul 2022 03:36:19 +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 26J3aJ6h096695; Tue, 19 Jul 2022 03:36:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26J3aJxd096694; Tue, 19 Jul 2022 03:36:19 GMT (envelope-from git) Date: Tue, 19 Jul 2022 03:36:19 GMT Message-Id: <202207190336.26J3aJxd096694@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 54291f7d6506 - main - swap_pager: Reduce the scope of the object lock in putpages List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 54291f7d6506e6c6087433c5bbdb2224b6cef23b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658201779; 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=fhDZK2H7oZGpp9Qvnx2Ft0yOXfxhx+FmNmUWiOwvPR0=; b=PUMNq26sUxO2yhAOv+N3Wos4E0dCTvW4fHohg0zJhh+2yAIoEq3no76BlQJX++WxIb6tOx BjuH3AtsiQ2q3r7bKxuVuPZrFwGtlyFH8srCrZVzMI+II7/zRrfRo03RV0uCKajBpQXqCL Jb3cREeNM8FxijrixQ7C4T1m2/miLZ3S8U8CWgnfw24xjXqyo405VBzIXTa9K/8ZffSXOD sFzZcBGIUg2x0CnoHDQoVUAadOa+08bgeQxjOGtGSQfH8EAUl4u6BJzYRUcQuinFj2fpfw rpetI2m7wMRiiI9DFr0Yax22ki9Xw79q+NXZkzIUNpCtYTrVNZU1ADMqhKEqow== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658201779; a=rsa-sha256; cv=none; b=fisoNLuxViPoLAy3nPYwbRU155pPdXzb7r0iTVHnW2Hrl2bRcYOaa5ISw0GJsRswtREUPJ 7yIeNGND2+yuCq3VgLAsM9G8t8rUQ7mSri0EMvwKYCVupTr00jmb7YO0XMPX7J1DJpp5qG 3JVdRy02RGRmYxAruU38qZZ9HfJBBinkqE5veuuSUY/YuPdBPkWXpOxBRHG2hg9XYRh9JH CR9m3IMPIUFAn4/EAJEps33JZ6m2CWO0Oozv6NW9rd6gO5VhVcqo10BcEhL2TXx5mZbU6K csxHFPB7bC+fOFYQwQvsTckhQUVL33yiqHOSGJPxB43ZnO7UYwgkzFGlaFjmxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=54291f7d6506e6c6087433c5bbdb2224b6cef23b commit 54291f7d6506e6c6087433c5bbdb2224b6cef23b Author: Alan Cox AuthorDate: 2022-07-19 03:28:07 +0000 Commit: Alan Cox CommitDate: 2022-07-19 03:35:49 +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 --- 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 c20360975c4b..67cc3bf017d2 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -1506,10 +1506,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); @@ -1518,6 +1516,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);