Comment 3 for bug 1814487

Revision history for this message
cell (jasonpepas) wrote :

I whipped up a simple mmap program:

#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>

int main(int argc, char** argv) {
    int fd = open(argv[1], O_RDONLY);
    if (fd == -1) {
        perror("open failed");
    }

    size_t sz = strtoll(argv[2], NULL, 10);
    if (sz == 0) {
        perror("strtoll failed");
    }

    char *mem = mmap(0, sz, PROT_READ, MAP_PRIVATE, fd, 0);
    if (mem == (void*)-1) {
        perror("mmap failed");
    }

    return 0;
}

it looks like the ARM machines have no problem with a large mmap call (100GB succeeds but 1TB fails):

root@zerow1:/tmp# gcc -Wall mmap.c
root@zerow1:/tmp# ./a.out a.out 1
root@zerow1:/tmp# ./a.out a.out 10
root@zerow1:/tmp# ./a.out a.out 100
root@zerow1:/tmp# ./a.out a.out 1000
root@zerow1:/tmp# ./a.out a.out 10000
root@zerow1:/tmp# ./a.out a.out 100000
root@zerow1:/tmp# ./a.out a.out 1000000
root@zerow1:/tmp# ./a.out a.out 10000000
root@zerow1:/tmp# ./a.out a.out 100000000
root@zerow1:/tmp# ./a.out a.out 1000000000
root@zerow1:/tmp# ./a.out a.out 10000000000
root@zerow1:/tmp# ./a.out a.out 100000000000
root@zerow1:/tmp# ./a.out a.out 1000000000000
mmap failed: Cannot allocate memory

on all of the machines I tested, none of them had problems with over-allocating via mmap.

So I'd guess the problem lies in how sbcl was compiled for Raspbian.