diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2023-06-26 14:26:51 +0300 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-07-03 02:08:39 +0200 |
commit | dc0c9160173d2a5b40e9d6e29c1800102b17b1ec (patch) | |
tree | 5625d9232456701b80645ae86a7b0f102c13301e /vm/vm_map.c | |
parent | 505ecd7b30fca1dc296205ff3c0dc3aff9d76e12 (diff) | |
download | gnumach-dc0c9160173d2a5b40e9d6e29c1800102b17b1ec.tar.gz gnumach-dc0c9160173d2a5b40e9d6e29c1800102b17b1ec.tar.bz2 gnumach-dc0c9160173d2a5b40e9d6e29c1800102b17b1ec.zip |
vm: Allow coalescing a VM object with itself
If a mapping of an object is made right next to another mapping of the
same object have the same properties (protection, inheritance, etc.),
Mach will now expand the previous VM map entry to cover the new address
range instead of creating a new entry.
Message-Id: <20230626112656.435622-3-bugaevc@gmail.com>
Diffstat (limited to 'vm/vm_map.c')
-rw-r--r-- | vm/vm_map.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/vm/vm_map.c b/vm/vm_map.c index 23c4c296..f701a4cf 100644 --- a/vm/vm_map.c +++ b/vm/vm_map.c @@ -1048,8 +1048,7 @@ kern_return_t vm_map_enter( * extend from below.] */ - if ((object == VM_OBJECT_NULL) && - (entry != vm_map_to_entry(map)) && + if ((entry != vm_map_to_entry(map)) && (entry->vme_end == start) && (!entry->is_shared) && (!entry->is_sub_map) && @@ -1059,20 +1058,21 @@ kern_return_t vm_map_enter( (entry->wired_count == 0) && (entry->projected_on == 0)) { if (vm_object_coalesce(entry->object.vm_object, - VM_OBJECT_NULL, + object, entry->offset, - (vm_offset_t) 0, + offset, (vm_size_t)(entry->vme_end - entry->vme_start), - (vm_size_t)(end - entry->vme_end))) { + size)) { /* * Coalesced the two objects - can extend * the previous map entry to include the * new range. */ - map->size += (end - entry->vme_end); + map->size += size; entry->vme_end = end; vm_map_gap_update(&map->hdr, entry); + vm_object_deallocate(object); RETURN(KERN_SUCCESS); } } |