From nobody Sat Sep 28 21:47:46 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 4XGLXy1jCtz5XtR2; Sat, 28 Sep 2024 21:47:46 +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 4XGLXy1BjHz43y8; Sat, 28 Sep 2024 21:47:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727560066; 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=soClXItNKGZ0U+ST0i+lvDk93HyX4vfu8E4Jl+VhmrY=; b=msnMutnaBz9y/rjJh34DkjgNEYoo7DNlQ7npA0jEtKVbrQz2DndBwXxOpUOLdVwL9ySuqB JK49/AzRHFaV+2ov85yYmzK1i+t3rAc47/2dF+jBlq27elx8FNUCCCD7o9Lfn867gtFzPu suyG9OKc4I8SAROm4FDHMum3Gzo86WyvI+CFv4bdHTJ8eV9kkZ67H2Yp0KU4jeWUqINCEF l/oDtdH+53OAOIHezVpCBnbNzeF07fmblxoIOU99VJZyrb+QFXzgZNonJwfggcNc4UjBSm Dyzk8MdZHEMilUWjw3xvjlg7nJeKZPCqkPqRPBW382KUy2nJHCnIpORxC05FyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727560066; 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=soClXItNKGZ0U+ST0i+lvDk93HyX4vfu8E4Jl+VhmrY=; b=Foo1XnYUGeo5ozFIX49nnjHGEkXt56bJOE1GtjNfgDgramTUAGMF56yIYm1sKjyXBACgAX GvYNX16AWaWrxnJyN/YnzD6cu2++ehfPbGFb4Tu4m18X4L3EubkmjhlNAMyQCqcwvTb88c U+TUcI53kKLIEPApv14jLxduIFWFFCDfL04w07h+9PRf96u3S0Kv6yxP+aLzMsS0KrXk2A XSfLLBasimnTPom0Ewa7ISS5JwFN9X3qDEkBQl4QJCFZRcEg7Fy9D2sAD0AeANyobJIiuO 8TRX9aHatlDwvBDIDaUYgD0ee2u+mpeKXf29gcwKHKNN25pir+jdTkRsZVhJOg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727560066; a=rsa-sha256; cv=none; b=Hy8GY+YLuMaITPPOHnfSl6cjE1FgnzOSIaERfFIwexpbRvjo3C9hwt4OsY5gf/euoOKOGw u2v8kfwFNw9qZyoGZ5igjqfUEOkIiUMhtWJDCYYkT51DO2k+sjHI4igd8yRfme8gSlm0p/ iBgOkwedCkuuOWLgAM2GRZIti4BiCt+GZRw7r1Eap5iwDSJVTM4Sf60WXKppDE9wvCPQn0 wNLIrUrFrDf6PjwqMj2rwmnIjXfQtiHg33y4KRq8WvGGwr7PAEhm1pg8xFqhI+ZYLtji2D EonUTzU99t5nzuaaWKOPlVYXpA+tVnTuQOp+b8GMOHhGV1upPTMUI5WLQLtt7Q== 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 4XGLXy0ngxzj3K; Sat, 28 Sep 2024 21:47:46 +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 48SLlkEe035765; Sat, 28 Sep 2024 21:47:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48SLlkXm035762; Sat, 28 Sep 2024 21:47:46 GMT (envelope-from git) Date: Sat, 28 Sep 2024 21:47:46 GMT Message-Id: <202409282147.48SLlkXm035762@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: 76c60597fa2a - main - swap_pager: use vm_page_iterators for lookup 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: 76c60597fa2af9ec5b5a24305794b70ad1530755 Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=76c60597fa2af9ec5b5a24305794b70ad1530755 commit 76c60597fa2af9ec5b5a24305794b70ad1530755 Author: Doug Moore AuthorDate: 2024-09-28 21:46:40 +0000 Commit: Doug Moore CommitDate: 2024-09-28 21:46:40 +0000 swap_pager: use vm_page_iterators for lookup Replace the use of page lookups and page next pointers in swap_pager.c with vm_page iterators. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D46704 --- sys/vm/swap_pager.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index aa0297daefe9..fbf2967aaf17 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -1856,6 +1856,7 @@ swap_pager_swapped_pages(vm_object_t object) static void swap_pager_swapoff_object(struct swdevt *sp, vm_object_t object) { + struct pctrie_iter pages; struct page_range range; struct swblk *sb; vm_page_t m; @@ -1870,6 +1871,7 @@ swap_pager_swapoff_object(struct swdevt *sp, vm_object_t object) pi = 0; i = 0; + vm_page_iter_init(&pages, object); swp_pager_init_freerange(&range); for (;;) { if (i == 0 && (object->flags & OBJ_DEAD) != 0) { @@ -1896,7 +1898,6 @@ swap_pager_swapoff_object(struct swdevt *sp, vm_object_t object) if (sb == NULL) break; sb_empty = true; - m = NULL; } /* Skip an invalid block. */ @@ -1904,7 +1905,6 @@ swap_pager_swapoff_object(struct swdevt *sp, vm_object_t object) if (blk == SWAPBLK_NONE || !swp_pager_isondev(blk, sp)) { if (blk != SWAPBLK_NONE) sb_empty = false; - m = NULL; i++; continue; } @@ -1913,8 +1913,7 @@ swap_pager_swapoff_object(struct swdevt *sp, vm_object_t object) * Look for a page corresponding to this block, If the found * page has pending operations, sleep and restart the scan. */ - m = m != NULL ? vm_page_next(m) : - vm_page_lookup(object, sb->p + i); + m = vm_page_iter_lookup(&pages, sb->p + i); if (m != NULL && (m->oflags & VPO_SWAPINPROG) != 0) { m->oflags |= VPO_SWAPSLEEP; VM_OBJECT_SLEEP(object, &object->handle, PSWP, "swpoff", @@ -2272,6 +2271,7 @@ static void swp_pager_meta_free(vm_object_t object, vm_pindex_t pindex, vm_pindex_t count, vm_size_t *freed) { + struct pctrie_iter pages; struct page_range range; struct swblk *sb; vm_page_t m; @@ -2282,11 +2282,11 @@ swp_pager_meta_free(vm_object_t object, vm_pindex_t pindex, vm_pindex_t count, VM_OBJECT_ASSERT_WLOCKED(object); fc = 0; - m = NULL; if (count == 0 || swblk_is_empty(object)) goto out; swp_pager_init_freerange(&range); + vm_page_iter_init(&pages, object); last = pindex + count; sb = swblk_start_limit(object, pindex, last); start = (sb != NULL && sb->p < pindex) ? pindex - sb->p : 0; @@ -2298,9 +2298,7 @@ swp_pager_meta_free(vm_object_t object, vm_pindex_t pindex, vm_pindex_t count, continue; swp_pager_update_freerange(&range, sb->d[i]); if (freed != NULL) { - m = (m != NULL && m->pindex == sb->p + i - 1) ? - vm_page_next(m) : - vm_page_lookup(object, sb->p + i); + m = vm_page_iter_lookup(&pages, sb->p + i); if (m == NULL || vm_page_none_valid(m)) fc++; }