]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
kern: physmem: improve region coalescing logic
authorKyle Evans <kevans@FreeBSD.org>
Thu, 28 Oct 2021 04:40:08 +0000 (23:40 -0500)
committerKyle Evans <kevans@FreeBSD.org>
Mon, 20 Feb 2023 19:58:20 +0000 (13:58 -0600)
commit13f1d1bd86476393b8a2ec2c79cb0b1637fcdec6
tree5db5393c087ea522fadd658daed08e8424c6eeae
parent24a7d13928234ff989bdbf8a5f1397b94f086bdd
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)
Differential Revision: https://reviews.freebsd.org/D32701

(cherry picked from commit 7771f2a0c94fc2f7b9ce1565a49e52dba1e7381d)
sys/kern/subr_physmem.c