From nobody Sat Jul 27 21:14:53 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 4WWcp52Fs6z5Rhhf; Sat, 27 Jul 2024 21:14:53 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WWcp51mhvz4798; Sat, 27 Jul 2024 21:14:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722114893; 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=AI74b+ORDjJMi8OrQ6iA0xfsy5nMHL+CdSzRa4Wo6I8=; b=jyVGBE2FETh53C+pQ3UnTO89D5UryvOXpsd7Er0g7bcwemRszldwCeIEI3KdFYi05jIlIY C9P1R78bMgvbnE0Bt91z94R45hZiFP9/vqUyfrF2kUbfT9llaIWPRZc2Krt5655MwI5Koo 8lH+J5NO2cZ75lcPScL55qO0eFVAffEdqe6Hy5d/BbetnLgEWnfispsxRmv5T+MwEuFMZb Dwhi44Rke3hFTob5L0bYSHTGG/IJgOHaZNVrEGDGSBgGIPnr4XAnWAbuojiGT6VCkDiKgG V0TuOT6bQZXuSMMHz3HsKQB8+VMohpeqxkQaa7R9PMhXKcx7RzjvzSx1g6fB4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722114893; a=rsa-sha256; cv=none; b=uTDJrxcFkgOANxi9qah8aSS/YqySY0L0h1/JE7jVc+tiF1TiFColMJB7N3Pw13hIYUqB3e qPL1bnAgSAz4jLS1JC38KLZBHQwhvScAnf88OGbo8OeghG40It+02Qy9b3fpQWpyGWD8fA OijCIovpcCGXdneKOoj8Ve2G6kjRs4ANcEGWfYR+X2vMJ0T5PGp3weYaAvLhkqY2J0rYq5 fryQ2sIxFeIhxm7Ms7ls4AOiKhfTYQr6gnS06+Ico/Hok3s9eAWLJG4x+Lw9e/FCekvf4c W3lh+q1Q6Shl+hMjc/3n3wdmco77VM5crJEGMLnGIDeCnuPsw46AchXqCRnMpA== 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=1722114893; 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=AI74b+ORDjJMi8OrQ6iA0xfsy5nMHL+CdSzRa4Wo6I8=; b=l1LpRVS6mdeNd3m3m+f82JoP4bFQI/+d712AYuurYJ4A4xosWcEZhjmfc/Y+AH5zM1tkYQ 3+qXTcqgiFoAvhsX8fPP6yMHOQ97LoElsF62UqPyRfZGf6+HuItom2vb4gJ/D5QP59hLNC kCT8Ww9J3I9nvA/9i2mPiKlqZMNyHMkqnohr83Tnws+5o1PiptpEEUpJ7dcfzK+qtRWMQl pna1gGz+JAzJZll73u3kQfegmSZR/JtFOYwbqEUA8QuX0oVjzWjfBES8UNxEiBXtWOPOVm 3xeGcNHQin0XFFUiFFFlE3y61JWfOj6EmmI/QxR0NCOezVuy831KPTMKDsuyNg== 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 4WWcp51M5jzN2t; Sat, 27 Jul 2024 21:14:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46RLErkA091121; Sat, 27 Jul 2024 21:14:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46RLErUM091118; Sat, 27 Jul 2024 21:14:53 GMT (envelope-from git) Date: Sat, 27 Jul 2024 21:14:53 GMT Message-Id: <202407272114.46RLErUM091118@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: b3cec803eaa4 - main - vm_fault: avoid vm_page_next() 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: b3cec803eaa4ae3495f9844f93c1f0cadc1b2d6a Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=b3cec803eaa4ae3495f9844f93c1f0cadc1b2d6a commit b3cec803eaa4ae3495f9844f93c1f0cadc1b2d6a Author: Doug Moore AuthorDate: 2024-07-27 21:11:53 +0000 Commit: Doug Moore CommitDate: 2024-07-27 21:11:53 +0000 vm_fault: avoid vm_page_next() Where vm_fault calls vm_page_next, replace it with a use of TAILQ_NEXT and a KASSERT. This avoids needless computation in a NODEBUG kernel and makes the error checking clearer in a GENERIC kernel. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D46168 --- sys/vm/vm_fault.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index df686f3e46dc..6e0415b30600 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -485,7 +485,9 @@ vm_fault_populate_cleanup(vm_object_t object, vm_pindex_t first, VM_OBJECT_ASSERT_WLOCKED(object); MPASS(first <= last); for (pidx = first, m = vm_page_lookup(object, pidx); - pidx <= last; pidx++, m = vm_page_next(m)) { + pidx <= last; pidx++, m = TAILQ_NEXT(m, listq)) { + KASSERT(m != NULL && m->pindex == pidx, + ("%s: pindex mismatch", __func__)); vm_fault_populate_check_page(m); vm_page_deactivate(m); vm_page_xunbusy(m); @@ -623,9 +625,10 @@ vm_fault_populate(struct faultstate *fs) } for (pidx = pager_first, m = vm_page_lookup(fs->first_object, pidx); pidx <= pager_last; - pidx += npages, m = vm_page_next(&m[npages - 1])) { + pidx += npages, m = TAILQ_NEXT(&m[npages - 1], listq)) { vaddr = fs->entry->start + IDX_TO_OFF(pidx) - fs->entry->offset; - + KASSERT(m != NULL && m->pindex == pidx, + ("%s: pindex mismatch", __func__)); psind = m->psind; while (psind > 0 && ((vaddr & (pagesizes[psind] - 1)) != 0 || pidx + OFF_TO_IDX(pagesizes[psind]) - 1 > pager_last ||