git: 276085c19299 - main - acpica: Fix SRAT memory region insertion sort
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 25 Nov 2026 20:06:33 UTC
The branch main has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=276085c192993e68aca41e2402f94436f99aa33b
commit 276085c192993e68aca41e2402f94436f99aa33b
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2026-11-25 04:16:31 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-11-25 19:53:48 +0000
acpica: Fix SRAT memory region insertion sort
The SRAT table can list memory regions in any order, but we need them
sorted. There is an insertion sort to accomplish this when building
the mem_info array, but instead of inserting the new region before
the *first* higher-base-address region, it was inserting the new
region before the *last* higher-base-address region; i.e. if the array
already held "1 3 4" then inserting "2" would produce "1 3 2 4".
Break out of the insertion-location-finding loop when we find the right
spot to insert the new memory region into the list, rather than looking
further.
Reviewed by: jhb
Fixes: dd540b46236b ("Add a parser for the ACPI SRAT table...")
MFC after: 1 day
Sponsored by: Amazon
Tested on: c5n.9xlarge, c6a.24xlarge, c6a.metal, c7a.metal-48xl
c7i.metal-24xl, c7i.metal-48xl, c8a.metal-24xl
c8i.metal-48xl, c8i.metal-96xl, c8in.96xlarge
c8in.metal-48xl, c8in.metal-96xl, m8azn.metal-24xl
Differential Revision: https://reviews.freebsd.org/D62059
---
sys/dev/acpica/acpi_pxm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sys/dev/acpica/acpi_pxm.c b/sys/dev/acpica/acpi_pxm.c
index 9eb95996eca0..3bce5b77ef08 100644
--- a/sys/dev/acpica/acpi_pxm.c
+++ b/sys/dev/acpica/acpi_pxm.c
@@ -370,6 +370,7 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg)
return;
}
slot = i;
+ break;
}
for (i = num_mem; i > slot; i--)
mem_info[i] = mem_info[i - 1];