From nobody Tue Dec 30 03:25:50 2025 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 4dgJQ6350Tz6MlBf for ; Tue, 30 Dec 2025 03:25:50 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dgJQ61Gddz3VgC for ; Tue, 30 Dec 2025 03:25:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767065150; 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=9LbPGd+7sN0KJ09mbAMrghVzP6Lb9fsel4jDZb1s3jI=; b=k1j6s0KXHE+RwB6wmNR5ATNmQHMaE0lLtUtFh3w67zIdjic8tLpcVqOTeamCvpXx+nlhLC r4OS/DfTz20kqdgwJq21/fltQxb3aept4U1oi7G8ygEFOg7qnLIBxtlExqL9+uY0IIKnu/ FJYJhEGRLIpEs6AXzvckaGOjleXx7zyHlKHeLChU6u3SezBt4ENDj6DYHqHQjRnH7SBvS/ YuX02aO0UCqf51wK0ypgWJSzCtug5sS1PxaYvuGODdVvdV5Psz6VycI/G4YmrNUDlonYJF 6yheO85UeJelhHkuIXSKz1vJDDhUpmpjbLqcckIjn+oaBAMlXijmbK6eOnH9EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767065150; 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=9LbPGd+7sN0KJ09mbAMrghVzP6Lb9fsel4jDZb1s3jI=; b=Ha2AXNcoFsVOBgOEl7R5KYAGS9LJcpLrDJB9ZMM6n2ke/wcQZhbU2wnv8y8j37dwjh64p6 FRFlN/IimNa8rm3ABqrzUr5fTLfaDpzWzTYibGVHWN+Zqo3VkUWet2IvASA5p2hu61XLmu TXKBNz+pq0QVlsj3JUQAjMtdV8CAhu3fIpB8HvU1JR9q4F8LjH4NIRPdimBPMALc5hhaXr DkYa0VZ8FjYIEthJwNzZFq4A1waFp+E3n4+sKzucQWu4aZSsIwwzKw2i4NxzvLCqAQ2j18 VPMvCSohwjp5Ink7ZZ5mGw40hKtUbL1U1lf6UZ4/4yOLr0S6X5BEuZ6LJPMy/g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1767065150; a=rsa-sha256; cv=none; b=rngDfeYH+IlnA8ilYhjDHJdY2BnaJRYeEMWiGs6DDj3+fIUP3r3UV4Li1KRUjsoMwmvITc EciD9KrwhlmzofGJoWFgrXViZRBxV8Yc7a+wWe25KFNzti0txSPyd3hkwzQFwe1uuHskGu mCaAWJ0mn7mxjvcxef495tElemuL0/L6WXAKqBwrUO/f/RB65Y2t8EUhIYn54tvPLF/EgO IU8imyLcRXHo98hSd66mdda2dZRzyVibK+O4hnGjoIW2JaCSxmlcggYc7bRz4OufGNwTLN WqNjTA0MFJSmVCHH11lhzpebtq9A12Z02Q/zTvxtU8qh/QPOkrMiRPim5+8f/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dgJQ60sQWzjvp for ; Tue, 30 Dec 2025 03:25:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 9dbb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 30 Dec 2025 03:25:50 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: e7053d9a126a - main - vm_object_coalesce(): simplify common expression 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e7053d9a126a60b3c0b1348b6c5131b5f2025894 Auto-Submitted: auto-generated Date: Tue, 30 Dec 2025 03:25:50 +0000 Message-Id: <6953463e.9dbb.36e75169@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e7053d9a126a60b3c0b1348b6c5131b5f2025894 commit e7053d9a126a60b3c0b1348b6c5131b5f2025894 Author: Konstantin Belousov AuthorDate: 2025-12-18 22:14:29 +0000 Commit: Konstantin Belousov CommitDate: 2025-12-30 03:25:20 +0000 vm_object_coalesce(): simplify common expression Add the next_end variable to replace commonly occuring the next_pindex + next_size expression. Suggested by: alc Reviewed by: alc, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54263 --- sys/vm/vm_object.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index a8ec98f2c98d..36edb279bbce 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2163,7 +2163,7 @@ boolean_t vm_object_coalesce(vm_object_t prev_object, vm_ooffset_t prev_offset, vm_size_t prev_size, vm_size_t next_size, boolean_t reserved) { - vm_pindex_t next_pindex; + vm_pindex_t next_end, next_pindex; if (prev_object == NULL) return (TRUE); @@ -2197,6 +2197,8 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset_t prev_offset, return (FALSE); } + next_end = next_pindex + next_size; + /* * Account for the charge. */ @@ -2224,14 +2226,13 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset_t prev_offset, * deallocation. */ if (next_pindex < prev_object->size) - vm_object_page_remove(prev_object, next_pindex, next_pindex + - next_size, 0); + vm_object_page_remove(prev_object, next_pindex, next_end, 0); /* * Extend the object if necessary. */ - if (next_pindex + next_size > prev_object->size) - prev_object->size = next_pindex + next_size; + if (next_end > prev_object->size) + prev_object->size = next_end; #ifdef INVARIANTS /* @@ -2243,7 +2244,7 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset_t prev_offset, vm_pindex_t pidx; pidx = swap_pager_seek_data(prev_object, next_pindex); - KASSERT(pidx >= next_pindex + next_size, + KASSERT(pidx >= next_end, ("found obj %p pindex %#jx e %#jx %#jx %#jx", prev_object, pidx, (uintmax_t)prev_offset, (uintmax_t)prev_size, (uintmax_t)next_size));