vm_map_simplify_entry considers merging an entry with its two neighbors, and is used in a way so that if entries a and b cannot be merged, we consider them twice, first not-merging a with its successor b, and then not-merging b with its predecessor a. This change would mostly replace vm_map_simplify_entry with a new function that compares two adjacent entries only, and uses it to avoid duplicated merge-checks.
Change loops that use vm_map_simplify_entry to use vm_map_try_merge_entries instead, without using entry prev pointers, which means searching for the entry before the first entry of the range to be processed, and maintaining both prev and entry pointers as entries are processed.
Change other vm_map_simplify_entry calls to use a pair of vm_map_merge_entry calls.