From nobody Tue Jun 11 16:38:49 2024 X-Original-To: dev-commits-src-all@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 4VzDrn2Ltnz5MG8d; Tue, 11 Jun 2024 16:38:49 +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 4VzDrn1rM4z446Z; Tue, 11 Jun 2024 16:38:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718123929; 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=X38Vb9Ae8sBST2naD9Wco9gIujfwVLxCgIiq+wxDbZo=; b=Hr7WkmXiVI9aRZgD56QWohYV7jWfBPNyHshdTS+RitGDZ5aY5HBJe5djAY6XN3lHTpDpxg 8+4EAL7zyAQHyvYjsGkzgR6kz++EKmx0PybznKIelQ215JUkin6GWvdNnLeb5iAhjvBs+e +ExBtBERTHEftb/FMWcbeF5+k7USZqem0aD6sE/dxgGkHUgnhH5vyyC4R9WYoDUH5K10jb BTA/fqI79c4LPOFdyatGBdezhkx1myw/+Ef0ADB0Rbcc1L3Au3QpXzx1EkH+dECLLJq9TY WiYYa2JFBxYNzZ4aFW1rvc+srH2ze9IKNm8M5hPh7j90S5xL3W6XVisrjsCbxw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718123929; a=rsa-sha256; cv=none; b=uR4vV2goanb6NT4ovp15j/pobAGws4GfPm0KM5sXqTi2n7f2WyJv2DFPhMUk4NEs3r7BWr urgSeikNaFpSIaQKIXIHGaJwchtb540faEdjXB+oOHytp1Z79W63usPYOAbMWwOEt3arUw iy324MPNPH5/G7Nu0xjdpzenNf90lLlNtZ6x82Gy2SCmOFci4JyqCzjoTJijhk7YrDmlg5 y533GLUkKcDHHx1wPTLnRKFK5xJQBGZW+QOzFYKvJGxGDUavb2D1s6bSGM0tNt6h2pGqkt oIYCtdTiEwFpwBSNBeAsuMNUI+OEijp3vYToJYRN1l+817WoID0jMoHm4m0/eA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718123929; 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=X38Vb9Ae8sBST2naD9Wco9gIujfwVLxCgIiq+wxDbZo=; b=u7Uvm0ezwDUx2EcsmrWQdpx4yUX9rhEkPp2IQkTRyRKneRB1NmGmgXws8mqu+fxHNkLwOA IPUVceEqlIsP6qSy0Ft0Sn/qj/hudP8jVSnm5Ue2MQY/5BHFf+SkIPZhNw/QbjLOIobsjU XXQyhg5uMpWHPyzjfTT/ZBw0fiiS1n9KTHKNKDXk4IpIRJFF3JyCS3O53iR9uBqOMr5+Fn 7LUqvlrKox94UcRbg4VsHsR/KuaLva3anQL0fBgzfAfQVjX/hCV/m8FfeZGBY1ZNKJGiNc ayMN3d9bpPtSxgi2ffKMWKlPWct1QV6zQ4BlI+rkgQHX6Y/Wqpt/Ji1Rt+ijkQ== 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 4VzDrn1KCHzHBX; Tue, 11 Jun 2024 16:38:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 45BGcnYx099473; Tue, 11 Jun 2024 16:38:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45BGcnhX099470; Tue, 11 Jun 2024 16:38:49 GMT (envelope-from git) Date: Tue, 11 Jun 2024 16:38:49 GMT Message-Id: <202406111638.45BGcnhX099470@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: dd0e5c02ab13 - main - swap_pager: small improvement to find_least List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: dd0e5c02ab13b9eb240d42a71a8f41a8b036bd33 Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=dd0e5c02ab13b9eb240d42a71a8f41a8b036bd33 commit dd0e5c02ab13b9eb240d42a71a8f41a8b036bd33 Author: Doug Moore AuthorDate: 2024-06-11 16:36:23 +0000 Commit: Doug Moore CommitDate: 2024-06-11 16:36:23 +0000 swap_pager: small improvement to find_least Drop an unneeded test, a branch and a needless computation to save a few instructions. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D45558 --- sys/vm/swap_pager.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index a07a38481490..15f227457bba 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -2289,22 +2289,17 @@ swap_pager_find_least(vm_object_t object, vm_pindex_t pindex) VM_OBJECT_ASSERT_LOCKED(object); MPASS((object->flags & OBJ_SWAP) != 0); - if (pctrie_is_empty(&object->un_pager.swp.swp_blks)) - return (object->size); sb = SWAP_PCTRIE_LOOKUP_GE(&object->un_pager.swp.swp_blks, rounddown(pindex, SWAP_META_PAGES)); if (sb == NULL) return (object->size); - if (sb->p < pindex) { - for (i = pindex % SWAP_META_PAGES; i < SWAP_META_PAGES; i++) { - if (sb->d[i] != SWAPBLK_NONE) - return (sb->p + i); - } - sb = SWAP_PCTRIE_LOOKUP_GE(&object->un_pager.swp.swp_blks, - roundup(pindex, SWAP_META_PAGES)); - if (sb == NULL) - return (object->size); + for (i = pindex - sb->p; i < SWAP_META_PAGES; i++) { + if (sb->d[i] != SWAPBLK_NONE) + return (sb->p + i); } + sb = SWAP_PCTRIE_LOOKUP_GE(&object->un_pager.swp.swp_blks, pindex); + if (sb == NULL) + return (object->size); for (i = 0; i < SWAP_META_PAGES; i++) { if (sb->d[i] != SWAPBLK_NONE) return (sb->p + i); @@ -2314,7 +2309,7 @@ swap_pager_find_least(vm_object_t object, vm_pindex_t pindex) * We get here if a swblk is present in the trie but it * doesn't map any blocks. */ - MPASS(0); + __unreachable(); return (object->size); }