git: 12857d8f4269 - main - vm_object: Augment an assertion in vm_object_split()

Mark Johnston <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.current.scm
Message-ID <[email protected]>
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=12857d8f4269af7df85605b48ae5e7b2fd810fde

commit 12857d8f4269af7df85605b48ae5e7b2fd810fde
Author:     Mark Johnston <[email protected]>
AuthorDate: 2026-08-11 14:10:23 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2026-08-11 14:10:23 +0000

    vm_object: Augment an assertion in vm_object_split()
    
    In some private discussion it was pointed out that vm_object_split()'s
    pattern of dropping the source object lock looks dangerous in that the
    initial assumption that OBJ_ONEMAPPING is set may become false.  In
    practice I believe that the map lock holds this flag stable, but let's
    assert that.
    
    Reviewed by:    alc, kib
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D58766
---
 sys/vm/vm_object.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index aa2d7676e6a8..1e6e25d26a54 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -1515,7 +1515,8 @@ vm_object_split(vm_map_entry_t entry)
 
 	orig_object = entry->object.vm_object;
 	KASSERT((orig_object->flags & OBJ_ONEMAPPING) != 0,
-	    ("vm_object_split:  Splitting object with multiple mappings."));
+	    ("%s: splitting object %p with multiple mappings",
+	    __func__, orig_object));
 	if ((orig_object->flags & OBJ_ANON) == 0)
 		return;
 	if (orig_object->ref_count <= 1)
@@ -1574,6 +1575,8 @@ vm_object_split(vm_map_entry_t entry)
 	vm_object_set_flag(orig_object, OBJ_SPLIT);
 	vm_page_iter_limit_init(&pages, orig_object, offidxstart + size);
 retry:
+	KASSERT((orig_object->flags & OBJ_ONEMAPPING) != 0,
+	    ("%s: object %p lost ONEMAPPING", __func__, orig_object));
 	KASSERT(pctrie_iter_is_reset(&pages),
 	    ("%s: pctrie_iter not reset for retry", __func__));
 	for (m = vm_radix_iter_lookup_ge(&pages, offidxstart); m != NULL;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.