From nobody Sun Dec 08 20:31:16 2024 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 4Y5xTw3chPz5f8sR; Sun, 08 Dec 2024 20:31:16 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y5xTw22pBz4RYS; Sun, 8 Dec 2024 20:31:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733689876; 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=XQm+Qqo5gdCSac3pP1o8EPiypzoppR9i30saT5JRzqI=; b=Wcd0n/gPBzUNMxlZYkSGV920uTfO739f3BBkr33NenIE1RqMMCgj0uXvPO4ePegIg0Wn/R fKTBKPdDNO1BBjzYjnmiAe3A/Mj1h88Tsf/R5xP1naA4Gw6y6VNtOAcGzTLXIPvb/mXG7X 3vSLPU44acWQ08fw62pnhm3Z/JNVXxZDMhM0MgNsc03chFUEn6p7cgbeFs3ZrabYIUL8nd Gay+cS/skpBwWOVfnsRHnvwsJ7jGi6vN3kEjfulw3GWLaM0pVdxQnujZUVEXi5oPUAzXVj VWvbFL4pqQnQMrioCYNNkuP9nG3MDjfI6cAfwpMuv7qie5403dqOtwIddYmBTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733689876; 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=XQm+Qqo5gdCSac3pP1o8EPiypzoppR9i30saT5JRzqI=; b=SLAW3A4HTaqbq5ZcpQ+nmJN6FQY/7aQcLZv3EW7TtPa+jnVez0YryJGMGrMnXoFED9GlOe /2v/vFYNRhUii4ZehnXkNoOyqZgJZa4q/zt+T3bPXDtGsq+G7q0bfapih6R9Py6F89sm23 q820bEtdJyWuUZyzyIKTBAKIX6uSW2A2W8G8kVASgg/EQX8wXJd+sR2IAQc/TX9SQh5z4S oGHu67ux1UaS+cuEkSG2//Pl2C96NGZDOG5TN+3yNt7On6/CtQ008+LznsK6xOLc9GrL6J TmnsNWXazybWLZ9ZRtc2geA/xTggmxE5a1wtjN2Y3PZ72hulYsKFdSplQn3zOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733689876; a=rsa-sha256; cv=none; b=PXQomNr/tC99Gt0UjLS2/vpwwiKGpMAWWDFK8SRFCL2Ke8DAhpgOw8ms3EOz16Y8D6FeJp CnkrTDqyfDgw2aBP+yd6HCZqkCw4Vd0itUi7L7WP6WtJnR0+XRD1MzcitEGv0pIf/duMgD BS8Ziy/4lfzc03SQzUX8Y4RI8djTnkxwDTX5ankgD649uht5bMSrgdlv6KFDSgHGmApYAF V4FQT+KtGHWsV6m0AdH/DQR92hNOsrQ7LlfkPSjLpPPinKNS+2eOHt0eHJHMcGcdLj2DG/ ikQ/oSQB9M1Jui+beD42vXPiboEBYeoRGlURii+lb1RhQ5fVyeXIegCncqueHg== 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 4Y5xTw1fncz16Hp; Sun, 8 Dec 2024 20:31:16 +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 4B8KVGLx015072; Sun, 8 Dec 2024 20:31:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B8KVGb3015069; Sun, 8 Dec 2024 20:31:16 GMT (envelope-from git) Date: Sun, 8 Dec 2024 20:31:16 GMT Message-Id: <202412082031.4B8KVGb3015069@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: c1d12b925b2c - main - vm_page: pass page to iter_remove 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: c1d12b925b2c87d55a86b874e7b7e7a590844eb9 Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=c1d12b925b2c87d55a86b874e7b7e7a590844eb9 commit c1d12b925b2c87d55a86b874e7b7e7a590844eb9 Author: Doug Moore AuthorDate: 2024-12-08 20:30:22 +0000 Commit: Doug Moore CommitDate: 2024-12-08 20:30:22 +0000 vm_page: pass page to iter_remove Pass the to-be-freed page to vm_page_iter_remove as a parameter, rather than computing it from the iterator parameter, to improve performance. Reviewed by: alc Differential Revision: https://reviews.freebsd.org/D47730 --- sys/arm/nvidia/drm2/tegra_bo.c | 2 +- sys/vm/device_pager.c | 10 +++++----- sys/vm/vm_object.c | 8 ++++---- sys/vm/vm_page.c | 6 ++---- sys/vm/vm_page.h | 2 +- sys/vm/vm_pager.h | 2 +- 6 files changed, 14 insertions(+), 16 deletions(-) diff --git a/sys/arm/nvidia/drm2/tegra_bo.c b/sys/arm/nvidia/drm2/tegra_bo.c index 0b62e78224dc..6d380b95a4a9 100644 --- a/sys/arm/nvidia/drm2/tegra_bo.c +++ b/sys/arm/nvidia/drm2/tegra_bo.c @@ -64,7 +64,7 @@ tegra_bo_destruct(struct tegra_bo *bo) for (i = 0; i < bo->npages; i++) { m = vm_page_iter_lookup(&pages, i); vm_page_busy_acquire(m, 0); - cdev_mgtdev_pager_free_page(&pages); + cdev_mgtdev_pager_free_page(&pages, m); m->flags &= ~PG_FICTITIOUS; vm_page_unwire_noq(m); vm_page_free(m); diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c index 55bc948a4c44..24241d118c7a 100644 --- a/sys/vm/device_pager.c +++ b/sys/vm/device_pager.c @@ -268,7 +268,7 @@ cdev_pager_free_page(vm_object_t object, vm_page_t m) vm_page_iter_init(&pages, object); vm_page_iter_lookup(&pages, m->pindex); - cdev_mgtdev_pager_free_page(&pages); + cdev_mgtdev_pager_free_page(&pages, m); } else if (object->type == OBJT_DEVICE) dev_pager_free_page(object, m); else @@ -277,10 +277,10 @@ cdev_pager_free_page(vm_object_t object, vm_page_t m) } void -cdev_mgtdev_pager_free_page(struct pctrie_iter *pages) +cdev_mgtdev_pager_free_page(struct pctrie_iter *pages, vm_page_t m) { - pmap_remove_all(vm_radix_iter_page(pages)); - vm_page_iter_remove(pages); + pmap_remove_all(m); + vm_page_iter_remove(pages, m); } void @@ -298,7 +298,7 @@ retry: pctrie_iter_reset(&pages); goto retry; } - cdev_mgtdev_pager_free_page(&pages); + cdev_mgtdev_pager_free_page(&pages, m); } VM_OBJECT_WUNLOCK(object); } diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index ff95469749b7..a3cfb4d036be 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -1599,7 +1599,7 @@ retry: * an incomplete fault. Just remove and ignore. */ if (vm_page_none_valid(m)) { - if (vm_page_iter_remove(&pages)) + if (vm_page_iter_remove(&pages, m)) vm_page_free(m); continue; } @@ -1727,7 +1727,7 @@ vm_object_collapse_scan(vm_object_t object) KASSERT(!pmap_page_is_mapped(p), ("freeing mapped page %p", p)); - if (vm_page_iter_remove(&pages)) + if (vm_page_iter_remove(&pages, p)) vm_page_free(p); next = vm_radix_iter_step(&pages); continue; @@ -1736,7 +1736,7 @@ vm_object_collapse_scan(vm_object_t object) if (!vm_page_all_valid(p)) { KASSERT(!pmap_page_is_mapped(p), ("freeing mapped page %p", p)); - if (vm_page_iter_remove(&pages)) + if (vm_page_iter_remove(&pages, p)) vm_page_free(p); next = vm_radix_iter_step(&pages); continue; @@ -1779,7 +1779,7 @@ vm_object_collapse_scan(vm_object_t object) ("freeing mapped page %p", p)); if (pp != NULL) vm_page_xunbusy(pp); - if (vm_page_iter_remove(&pages)) + if (vm_page_iter_remove(&pages, p)) vm_page_free(p); next = vm_radix_iter_step(&pages); continue; diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 8a23f900e987..f351295c1af5 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1752,16 +1752,14 @@ vm_page_remove(vm_page_t m) /* * vm_page_iter_remove: * - * Remove the current page, as identified by iterator, and remove it from the + * Remove the current page, and use the iterator to remove it from the * radix tree. */ bool -vm_page_iter_remove(struct pctrie_iter *pages) +vm_page_iter_remove(struct pctrie_iter *pages, vm_page_t m) { - vm_page_t m; bool dropped; - m = vm_radix_iter_page(pages); vm_radix_iter_remove(pages); vm_page_remove_radixdone(m); dropped = (vm_page_drop(m, VPRC_OBJREF) == VPRC_OBJREF); diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 29344eadbf05..744688bf789b 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -654,7 +654,7 @@ void vm_page_iter_free(struct pctrie_iter *pages, vm_page_t m); void vm_page_iter_init(struct pctrie_iter *, vm_object_t); void vm_page_iter_limit_init(struct pctrie_iter *, vm_object_t, vm_pindex_t); vm_page_t vm_page_iter_lookup(struct pctrie_iter *, vm_pindex_t); -bool vm_page_iter_remove(struct pctrie_iter *pages); +bool vm_page_iter_remove(struct pctrie_iter *pages, vm_page_t m); bool vm_page_iter_rename(struct pctrie_iter *old_pages, vm_page_t m, vm_object_t new_object, vm_pindex_t new_pindex); void vm_page_launder(vm_page_t m); diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 0958d82d6968..c4a9b5e9dcb9 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -300,7 +300,7 @@ vm_object_t cdev_pager_allocate(void *handle, enum obj_type tp, vm_ooffset_t foff, struct ucred *cred); vm_object_t cdev_pager_lookup(void *handle); void cdev_pager_free_page(vm_object_t object, vm_page_t m); -void cdev_mgtdev_pager_free_page(struct pctrie_iter *pages); +void cdev_mgtdev_pager_free_page(struct pctrie_iter *pages, vm_page_t m); void cdev_mgtdev_pager_free_pages(vm_object_t object); struct phys_pager_ops {