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
This commit is contained in:
Mark Johnston committed 2026-08-11 14:10:23 +00:00
1 parent 6a8558cf9f
commit 12857d8f42
1 file changed
+4 -1
+4 -1
View File
@@ -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;