Hello,
Coming back to the surf/luakit abort from July.
Samuel Thibault, le ven. 17 juil. 2026 20:18:12 +0200, a ecrit:
> Jose Luis Alarcon Sanchez, le ven. 17 juil. 2026 13:31:49 +0200, a ecrit:
> > Given that JSC needs a full 4 GiB (4,194,304 KB) contiguous reservation for
> > structureIDMask,
>
> Eh? Why does it need such a large thing?
>
> How can it run on a Linux system which has less than 4GB or ram+swap?
JSC keeps all its Structure objects in one 4 GiB area, so that a
StructureID fits in 32 bits. On Linux it reserves that area with
MAP_NORESERVE, and the default overcommit check doesn't count such
mappings. On the Hurd WebKitGTK 2.50.5 doesn't pass the flag.
In February you said this might be a case for implementing
MAP_NORESERVE. The TODO list on the contributing page also asks to
check whether MAP_NORESERVE gets around the limit, so I tried that. It
doesn't yet. I ran the program below in a 2 GiB x86_64 VM with gnumach
90199be and hurd 6290b4c. With or without the flag, every mapping that
takes the task over RAM gets ENOMEM. On Linux only the plain mapping of
four times RAM fails. glibc's mmap ignores the flag, and gnumach
charges every mapping whose max_protection isn't VM_PROT_NONE.
#define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
int
main (void)
{
size_t ram = (size_t) sysconf (_SC_PHYS_PAGES) * sysconf (_SC_PAGESIZE);
int extra[] = { 0, MAP_NORESERVE };
for (int i = 0; i < 2; i++)
for (size_t len = ram / 2; len <= 4 * ram; len *= 2)
{
void *p = mmap (NULL, len, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | extra[i], -1, 0);
printf ("%-9s %6zu MiB: %s\n", extra[i] ? "NORESERVE" : "plain",
len >> 20, p == MAP_FAILED ? strerror (errno) : "ok");
if (p != MAP_FAILED)
munmap (p, len);
}
return 0;
}
Would you want MAP_NORESERVE mappings left out of the default limit,
the way Linux leaves them out of its overcommit check? vm_map has no
flags argument, so glibc would need some other way to pass the hint.
Regards,
ajrojas