HomeFreeBSD

kern: physmem: improve region coalescing logic

Description

kern: physmem: improve region coalescing logic

The existing logic didn't take into account newly inserted mappings
wholly contained by an existing region (or vice versa), nor did it
account for weird overlap scenarios. The latter is probably unlikely
to happen, but the former may happen in UEFI: BootServicesData allocated
within a large chunk of ConventionalMemory. This situation blows up vm
initialization.

While we're here, remove the "exact match" logic as it's likely wrong;
if an exact match exists with conflicting flags, for instance, then we
should probably be doing something else. The new logic takes into
account exact matches as part of the overlapping efforts.

Reviewed by: kib, mhorne (both earlier version)
Approved by: re (cperciva)

(cherry picked from commit 7771f2a0c94fc2f7b9ce1565a49e52dba1e7381d)
(cherry picked from commit 13f1d1bd86476393b8a2ec2c79cb0b1637fcdec6)

Details

Provenance
kevansAuthored on Oct 28 2021, 4:40 AM
Parents
rG57c37babde36: cleanvar: Be more careful when cleaning up /var.
Branches
Unknown
Tags
Unknown