When an image built with HAVE_MADVISE_HUGEPAGE runs on a kernel without
THP, msbrk() aborts although the heap mapping succeeded.

Keep requesting huge pages, but tolerate rejected advice.

Backported to gcl27 2.7.1-4+rpi1 and tested on a Pi 1 B+ with Trixie,
6.18.50+rpt-rpi-v6. Both GCL variants start. ANSI allocation, GC and
compilation pass; strace shows MADV_HUGEPAGE returning EINVAL.

Rebuilt Maxima 5.47.0 passes 43 checks and rtest1/rtest2: 507 cases,
five expected errors, no unexpected errors. Its launcher uses
GCL_MEM_MULTIPLE=1.0.

Introduced by 773905c4d4fb ("hugepage support").

Bug: https://github.com/RPi-Distro/repo/issues/400
Assisted-by: LLM
---
 gcl/o/msbrk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcl/o/msbrk.c b/gcl/o/msbrk.c
index c397e755..7a5f8f58 100644
--- a/gcl/o/msbrk.c
+++ b/gcl/o/msbrk.c
@@ -75,7 +75,7 @@ msbrk(intptr_t inc) {
     if (m+mps!=new_map(m+mps,p2-mps))
       return (void *)-1;
 #ifdef HAVE_MADVISE_HUGEPAGE
-    massert(!madvise(m,p2,MADV_HUGEPAGE));
+    (void)madvise(m,p2,MADV_HUGEPAGE);
 #endif
     mps=p2;
   }
-- 
2.39.5 (Apple Git-154)


Reply via email to