I've been playing around with large pages and libhugetlbfs and have
been having no such luck getting my code segment to be backed by large
pages.

I have a small example code that doesn't seem to be loading.

$ cat test.c
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>

#define SIZE (128 * 1024 * 1024)

static uint64_t array[SIZE];

int main(int argc, char **argv)
{
        uint64_t times = atoi(argv[1]);
        uint64_t iter;
        long long cum = 0.0;

        for(iter = 0; iter < times; iter++)
        {
                cum += array[rand()%SIZE];
        }
        printf("%llu\n", cum);
        return 0;
}
$ gcc -o test test.c -Wl,-zcommon-page-size=4194304
-Wl,-zmax-page-size=4194304 -lhugetlbfs

I'm running kernel 2.6.30 with gcc 4.3.3 and glibc 2.10.1 and libhugetlbfs 2.4

I realize that the static array at the top of the code isn't quite the
right place for this. I could replace the static declaration with a
malloc in main and it will more easily be backed by large pages.
However, this is just an example benchmark that does what the real
code is doing. The real code I'm trying to make work takes up a lot of
segments (because its just that big) and its jumping around function
calls from libraries to more libraries.

I thought this would be an easy program to make work with
libhugetlbfs. However, I'm running into issues.

$ hugectl -v -v --text --bss --heap --shm --data ./test 10000000
hugectl: INFO: HUGETLB_VERBOSE='4'
hugectl: INFO: LD_LIBRARY_PATH='/usr/local/lib:/usr/local/lib64:'
hugectl: INFO: HUGETLB_ELFMAP='R:W'
hugectl: INFO: HUGETLB_MORECORE='yes'
hugectl: INFO: HUGETLB_SHM='yes'
hugectl: WARNING: LD_PRELOAD not appropriate for this map combination
libhugetlbfs [uber-gamer:31047]: INFO: Parsed kernel version: [2] . [6] . [30]
libhugetlbfs [uber-gamer:31047]: INFO: Feature private_reservations is
present in this kernel
libhugetlbfs [uber-gamer:31047]: INFO: Kernel has MAP_PRIVATE
reservations.  Disabling heap prefaulting.
libhugetlbfs [uber-gamer:31047]: INFO: HUGETLB_SHARE=0, sharing disabled
libhugetlbfs [uber-gamer:31047]: INFO: Segment 0 (phdr 2):
0x400000-0x40089c  (filesz=0x89c) (prot = 0x5)
libhugetlbfs [uber-gamer:31047]: INFO: Segment 1 (phdr 3):
0x8008a0-0x40800ae0  (filesz=0x220) (prot = 0x3)
libhugetlbfs [uber-gamer:31047]: INFO: libhugetlbfs version: 2.4
libhugetlbfs [uber-gamer:31048]: INFO: Mapped hugeseg at
0x2aaaaac00000. Copying 0x89c bytes and 0 extra bytes from
0x400000...done
libhugetlbfs [uber-gamer:31047]: INFO: Prepare succeeded
libhugetlbfs [uber-gamer:31049]: WARNING: Unable to verify address
range 0x800000 - 0x800000.  Not empty?
libhugetlbfs [uber-gamer:31049]: INFO: Mapped hugeseg at
0x2aaaaac00000. Copying 0x220 bytes and 0 extra bytes from
0x8008a0...done
libhugetlbfs [uber-gamer:31047]: INFO: Prepare succeeded
Failed to map hugepage segment 1: 800000-40a00000 (errno=12)
Aborted

Any help would be appreciated.

Thanks,
- David Brown

------------------------------------------------------------------------------
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to