From nobody Mon May 13 18:34:25 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 4VdSnY32rtz5KlX0; Mon, 13 May 2024 18:34:25 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VdSnY2c0Yz4WcB; Mon, 13 May 2024 18:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715625265; 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=5wDMORjmeOyFsY3ur88J4icj1iSgBsyE/u7AD6K1nKE=; b=R7JCxhZhvUTP2f1XM5gNeOR5pRTr8uR+Y7z9/05ta+QuHI8ireUEqB/mk2ZSJdRN6Bd0iY VT3fxjfj+b8oDbKrIIs2ld9iemMoKjqB/dB/gIZnqZ/FoM4PcRy7bv8VeQ0BVvXbW76Go/ krfteUjE1SgbwkAVEqrh9taqZuSgM45I1VyKZtSujK3Vuzg0nsrfDETGrexfPt6MxgT6s6 ijoMwp2882WXD2317MZKKNBGLg9+Z9U0JjCyz9VKMzUEbMeUQ/K9j9ItPVJZcuIvU4uV1q +I++ygNCCATOCL7OYg8xYlOMn+ib69E0uwl96WrnTmNR/SdepefIA0YhEBmq/g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715625265; a=rsa-sha256; cv=none; b=EkMA+pnpl8B34Iy/Py4h09VwjNyNPqg20YxejOE5klW2am8CCmOfekocmafWShs4C8/vXi phshy6YSaiK2HEtVPuw44pZJaXkvdSIizyWQkyVkz9dHESObJfaYUrabhnUO6w7vmFh1nH GHw7fHA/s0ZuvaeGr7AVxheleTt3VbYqHrEQ8XPXrenMZJyAX1+lfEvE6KrAgsh+PZWllz +ie3NcHSfJsp+CtD9Ia4bXnGRtjTounHlAuIrBUNWtER1OPxyhhxL8BCm3JxWUkTV6pVd5 uVp6ACKbTGvom/Le0J1lgr0qU0h9c/wQKFm2M+DX/BjiF8tmBmBVMgs83muIEw== 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=1715625265; 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=5wDMORjmeOyFsY3ur88J4icj1iSgBsyE/u7AD6K1nKE=; b=UxH0ItXxK11ckdUWg7Atd9lTKgJRnQJ4I6PyIPtA9hqLjDN0jZb/jewGDd0JmTGdx7amf1 epyj8xdGvuOMvzzGxR5ptAoybAY0K4ZbzHKcv+TpWBC0VA2aPOyBB4zYMgdVdiFHj01RXI 4BH9K2E9fFYfzRu3XktXeN2H6Fno1/0zpFJVPkzFQdx80jsxERGpDoyOHmm/jdy9eHNYHm E5bpRBMwtM38uot+aqypY2dXJgQeZmhNxZeQrjpGh5ZYXtBcyq084+y6OJ/4gWCxWKzSbL Ca2Ax21scndBm13KeNUnmGGYQ6PigtfxVUYWNCJ3pmvA70MjzGKRhtNJec/lgw== 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 4VdSnY2Cc8z10Cw; Mon, 13 May 2024 18:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44DIYPwW050038; Mon, 13 May 2024 18:34:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44DIYPCZ050035; Mon, 13 May 2024 18:34:25 GMT (envelope-from git) Date: Mon, 13 May 2024 18:34:25 GMT Message-Id: <202405131834.44DIYPCZ050035@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 6ada4e8a0ae9 - main - swap-like pagers: assert that writemapping decrease does not pass zero 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: 6ada4e8a0ae901f0012015c8d277d80aad7d8f37 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6ada4e8a0ae901f0012015c8d277d80aad7d8f37 commit 6ada4e8a0ae901f0012015c8d277d80aad7d8f37 Author: Konstantin Belousov AuthorDate: 2024-05-08 13:58:52 +0000 Commit: Konstantin Belousov CommitDate: 2024-05-13 18:33:29 +0000 swap-like pagers: assert that writemapping decrease does not pass zero Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D45119 --- sys/fs/tmpfs/tmpfs_subr.c | 3 +++ sys/vm/swap_pager.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 84ce323441c1..4ddf2b4ba5ff 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -183,6 +183,9 @@ tmpfs_pager_release_writecount(vm_object_t object, vm_offset_t start, KASSERT((object->flags & OBJ_ANON) == 0, ("%s: object %p with OBJ_ANON", __func__, object)); old = object->un_pager.swp.writemappings; + KASSERT(old >= (vm_ooffset_t)end - start, + ("tmpfs obj %p writecount %jx dec %jx", object, (uintmax_t)old, + (uintmax_t)((vm_ooffset_t)end - start))); object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start; new = object->un_pager.swp.writemappings; tmpfs_pager_writecount_recalc(object, old, new); diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index ee236c7f3988..a07a38481490 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -3158,6 +3158,10 @@ swap_pager_release_writecount(vm_object_t object, vm_offset_t start, VM_OBJECT_WLOCK(object); KASSERT((object->flags & OBJ_ANON) == 0, ("Splittable object with writecount")); + KASSERT(object->un_pager.swp.writemappings >= (vm_ooffset_t)end - start, + ("swap obj %p writecount %jx dec %jx", object, + (uintmax_t)object->un_pager.swp.writemappings, + (uintmax_t)((vm_ooffset_t)end - start))); object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start; VM_OBJECT_WUNLOCK(object); }