git: 156b5b7bf44f - stable/13 - swap-like pagers: assert that writemapping decrease does not pass zero
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 20 May 2024 00:26:04 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=156b5b7bf44fd7be5d745accea741527c46532cc commit 156b5b7bf44fd7be5d745accea741527c46532cc Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-05-08 13:58:52 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-05-19 00:59:13 +0000 swap-like pagers: assert that writemapping decrease does not pass zero (cherry picked from commit 6ada4e8a0ae901f0012015c8d277d80aad7d8f37) --- 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 a69e0357bc59..90fffb11e4c6 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -179,6 +179,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 dd7fecc066c4..a3e312af2ed9 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -3183,6 +3183,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); }