From nobody Tue Nov 26 18:15:33 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 4XyW2v55qPz5dnvH; Tue, 26 Nov 2024 18:15:35 +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 4XyW2v2pfFz54cc; Tue, 26 Nov 2024 18:15:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732644935; 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=oHdHsgOTwQ5Sps0w0ppenC19J2ImeQlFbA55cFtEM+c=; b=DXFA/zxjxt9W7mXf8LoxleBZaoqZFko1sOPH38D1jWUznnvv55SawaEn47iIQ0Bsigupqy 3wzfll68HVf7kybCOtlPXmSL67mP6Tu0F6lMDG5hcdE8xHYputO2TwhgWeMTytRz9gjZb6 Um6E2IKRYv9a1Zl4qkkKE+lZmdHVH+hcgxb0lkmpalaxksLvoFi0P6AH/PLXDb1sU+QP4+ 6VFcBo57FJ2/AOWjOvQKVwtlGtO6QdZJ4PGtvTrvJjYWDZnsO2GjBgUrB1KH04TKdJZFs7 ftu+R/KFExrS6+ZDiwec9euBo0l+SONZwFnVu2LSZW+S61HOtBBZ0z1Plxktbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732644935; 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=oHdHsgOTwQ5Sps0w0ppenC19J2ImeQlFbA55cFtEM+c=; b=LJeOIRJB4OyymMysLrEO9r3Rkfke9Fkt19BHhwEXCsfOS2DRE2uV8n4o41paJN372JG/XJ vLAlqGgthRVzEWcIPO78bg1aM6oh4U7vSr5zCGamBVqHqtgrh1T3WIu9EgMK5MOe8n3+LQ t2NYekTQJh8PMrNNWbaVgqGb93gTe2GKkdAQonbcc1cSvJxJSeJobs2p7IAEiOKN2Dp2SS uV/WxUlVi9Rk4OYQ3wr74X7wOKtr0ZqBGQsHAnrqBaqzmlqzSgVOlp+XRKfsufGbAyGQO7 fJx2DEP4+qh8w4uE+3L5Z2e15gzulA0VA1+E+ZsnsCzBuBS8HFYCGQNuPsKrpg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732644935; a=rsa-sha256; cv=none; b=HFMIbNd6w315/mL8wyQ6n2+8GXxXOi/uykceHSAP8MYXFPadOYcLClgow5j9kMktd6RxrX 8dediajE9wYXpXeygiZkfIuSL4Lluwhfa6JLOWnJAjJIppGMG6v/VBmXOyThXxiUDhjhol t6p9mCIkTgxu8scAmYPN2YGugCms3Rn0Kn+Ep4q50UMzQRvpBlghiebH8p5d6eDQhdVklH tXfQyhjx9iJYgUN8XdV8jLHnQeUOfAqsqxGuJ2w19tko65QyrUIepx7Fn3ahArhzbv4obj 1vznCgPlh2t8snOKU7mjk1vHfg4w1U2XJX3QbBghPA49bjx8cyGsEOZ9bXG7WQ== 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 4XyW2s6Y5QzbVR; Tue, 26 Nov 2024 18:15:33 +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 4AQIFXLA074289; Tue, 26 Nov 2024 18:15:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AQIFXLU074286; Tue, 26 Nov 2024 18:15:33 GMT (envelope-from git) Date: Tue, 26 Nov 2024 18:15:33 GMT Message-Id: <202411261815.4AQIFXLU074286@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: 40c1672e886b - main - swap_pager: fix seek_data with invalid first page 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: 40c1672e886b86f4956c16e9f1161683328504ff Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=40c1672e886b86f4956c16e9f1161683328504ff commit 40c1672e886b86f4956c16e9f1161683328504ff Author: Doug Moore AuthorDate: 2024-11-26 18:12:08 +0000 Commit: Doug Moore CommitDate: 2024-11-26 18:12:08 +0000 swap_pager: fix seek_data with invalid first page Correct swap_pager_seek_data so that, when the first lookup finds no valid pages, second and subsequent lookups are attempted anyway. This was broken by db08b0b04deced766c3b5f07bcfb82333666226c. Reported by: marklmi@yahoo.com Reviewed by: kib Tested by: marklmi@yahoo.com Fixes: db08b0b04deced76 tmpfs_vnops: move swap work to swap_pager Differential Revision: https://reviews.freebsd.org/D47767 --- sys/vm/swap_pager.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index db925f4ae7f6..3d02f365cad9 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -2503,26 +2503,23 @@ swap_pager_seek_data(vm_object_t object, vm_pindex_t pindex) VM_OBJECT_ASSERT_RLOCKED(object); vm_page_iter_init(&pages, object); m = vm_page_iter_lookup_ge(&pages, pindex); - if (m != NULL) { - if (!vm_page_any_valid(m)) - m = NULL; - else if (pages.index == pindex) - return (pages.index); - } + if (m != NULL && pages.index == pindex && vm_page_any_valid(m)) + return (pages.index); swblk_iter_init_only(&blks, object); swap_index = swap_pager_iter_find_least(&blks, pindex); if (swap_index == pindex) return (swap_index); - if (swap_index == OBJ_MAX_SIZE) - swap_index = object->size; - if (m == NULL) - return (swap_index); - while ((m = vm_radix_iter_step(&pages)) != NULL && - pages.index < swap_index) { + /* + * Find the first resident page after m, before swap_index. + */ + while (m != NULL && pages.index < swap_index) { if (vm_page_any_valid(m)) return (pages.index); + m = vm_radix_iter_step(&pages); } + if (swap_index == OBJ_MAX_SIZE) + swap_index = object->size; return (swap_index); }