Recent changes have created, for the first time, physical memory segments that can be coalesced. Since we sometimes iterate over the physical memory segments, coalescing these segments at initialization time is a worthwhile change.
In principle, coalescing at the time of segment definition, in vm_phys_add_seg(), would be the ideal approach. However, in practice, coalescing can't occur until later, after free queues have been assigned to each segment.
Moreover, the code to perform coalescing in a single pass over the physical memory segments is much simpler than examining and potentially merging each new segment with its predecessor and successor.
What follows is an example from a machine artificially configured to have 1.5GB of RAM, although the limited RAM is not really a cause for the existence of coalescable segments.
Before
vm.phys_segs: SEGMENT 0: start: 0x10000 end: 0x9a000 domain: 0 free list: 0xffffffff8204feb0 SEGMENT 1: start: 0x103000 end: 0x200000 domain: 0 free list: 0xffffffff8204feb0 SEGMENT 2: start: 0x200000 end: 0x1000000 domain: 0 free list: 0xffffffff8204feb0 SEGMENT 3: start: 0x1000000 end: 0x270d000 domain: 0 free list: 0xffffffff8204fc40 SEGMENT 4: start: 0x2717000 end: 0x274c000 domain: 0 free list: 0xffffffff8204fc40 SEGMENT 5: start: 0x2800000 end: 0x5d748000 domain: 0 free list: 0xffffffff8204fc40
After
vm.phys_segs: SEGMENT 0: start: 0x10000 end: 0x9a000 domain: 0 free list: 0xffffffff8204feb0 SEGMENT 1: start: 0x103000 end: 0x1000000 domain: 0 free list: 0xffffffff8204feb0 SEGMENT 2: start: 0x1000000 end: 0x270d000 domain: 0 free list: 0xffffffff8204fc40 SEGMENT 3: start: 0x2717000 end: 0x274c000 domain: 0 free list: 0xffffffff8204fc40 SEGMENT 4: start: 0x2800000 end: 0x5d748000 domain: 0 free list: 0xffffffff8204fc40