• Kirill Smelkov's avatar
    bigfile/ram_shmfs: Warn users explicitly if fallocate() is not supported · e8c05a22
    Kirill Smelkov authored
    Currently wendelin.core does not work on e.g. Debian 7, because that
    distro has too old kernel without support for fallocate on tmpfs.
    But the diagnostics of failure is not clear and looks like just being
    out of memory:
    
        bigfile/tests/../virtmem.c:845 OOM      BUG!
    
    what happens in fact is that
    
        - virtmem tries to allocate a page -> calls shmfs_alloc_page(),
        - fallocate() fails with "operation not supported" error code
        - virtmem sees this as page allocation failure,
        - tries to reclaim pages,
        - but there are no allocated pages at all -> OOM
    
    Detect whether fallocate() error is operational error, or simply
    "fallocate not supported" and if latter, report to user. Now it looks
    like:
    
        bigfile/tests/../ram_shmfs.c:129 shmfs_alloc_page WARN: fallocate() not supported
        bigfile/tests/../virtmem.c:845 OOM      BUG!
    
    /cc @Tyagov
    e8c05a22
ram_shmfs.c 7.22 KB