File 1381-erts-Fix-failing-ASSERT-in-erl_mseg.c-on-PowerPC.patch of Package erlang
From 3b88299496e4ab1fe5a3cc5f91323fd5158b4bc9 Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Wed, 11 Oct 2023 13:15:41 +0200
Subject: [PATCH] erts: Fix failing ASSERT in erl_mseg.c on PowerPC
and other machines where the page size is larger than super alignment.
sys/common/erl_mseg.c:1401:erts_mseg_init()
Assertion failed: ((1 << (14)) % sysconf(_SC_PAGESIZE)) == 0
Now assert that super alignment can be achieved with mmap/munmap calls
*OR* already is guaranteed by every mmap call.
---
erts/emulator/sys/common/erl_mseg.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/erts/emulator/sys/common/erl_mseg.c b/erts/emulator/sys/common/erl_mseg.c
index 030e5b00a7..a43687ac3a 100644
--- a/erts/emulator/sys/common/erl_mseg.c
+++ b/erts/emulator/sys/common/erl_mseg.c
@@ -1414,7 +1414,8 @@ erts_mseg_init(ErtsMsegInit_t *init)
if (!IS_2POW(GET_PAGE_SIZE))
erts_exit(ERTS_ABORT_EXIT, "erts_mseg: Unexpected page_size %beu\n", GET_PAGE_SIZE);
- ASSERT((MSEG_ALIGNED_SIZE % GET_PAGE_SIZE) == 0);
+ ASSERT((MSEG_ALIGNED_SIZE % GET_PAGE_SIZE) == 0
+ || (GET_PAGE_SIZE % MSEG_ALIGNED_SIZE) == 0);
for (i = 0; i < no_mseg_allocators; i++) {
ErtsMsegAllctr_t *ma = ERTS_MSEG_ALLCTR_IX(i);
--
2.35.3