Hello,

I am trying some experiments with libhugetlbfs library. I want to fit
the text section of my executable in a hugepage. I also want to put
any other dependent library function (like printf, scanf etc) in
hugepage. So, I am trying to statically compile my binary.


But, I am not able to get it running. Any help on how to statically
compile programs with libhugetlbfs and get it running will be great, I
am struggling for two weeks now.


// a.c ------ Program ------

#include<stdio.h>
int main() {

  int a[1000000] = {1};
  scanf("%d", &a[0]); // Just so that I can analyse pmaps
  return 0;
}

//-------------End--------


Compilation Command:


$ gcc -c -o a.o a.c

$ gcc -static --verbose -B/usr/local/share/libhugetlbfs
-L/usr/local/lib -Wl,--hugetlbfs-align  -o static.out a.o
-Wl,--no-as-needed -lpthread  -Wl,--whole-archive -lhugetlbfs
-Wl,--no-whole-archive


-------------------------
Trying to run using :

$ sudo hugectl --verbose 99 --text --no-preload ./static.out hugectl: INFO:
LD_PRELOAD disabled hugectl: INFO: HUGETLB_DEBUG='yes' hugectl: INFO:
HUGETLB_VERBOSE='99' hugectl: INFO:
LD_LIBRARY_PATH='/usr/local/lib:/usr/local/lib64:' hugectl: INFO:
HUGETLB_ELFMAP='R' libhugetlbfs [p-Standard-PC-i440FX-PIIX-1996:4292]:
INFO: Found pagesize 2048 kB libhugetlbfs
[p-Standard-PC-i440FX-PIIX-1996:4292]: INFO: Detected page sizes:
libhugetlbfs [p-Standard-PC-i440FX-PIIX-1996:4292]: INFO: Size: 2048 kB
(default) Mount: /dev/hugepages libhugetlbfs
[p-Standard-PC-i440FX-PIIX-1996:4292]: INFO: Parsed kernel version: [4] .
[3] . [0] libhugetlbfs [p-Standard-PC-i440FX-PIIX-1996:4292]: INFO: Feature
private_reservations is present in this kernel libhugetlbfs
[p-Standard-PC-i440FX-PIIX-1996:4292]: INFO: Feature noreserve_safe is
present in this kernel libhugetlbfs [p-Standard-PC-i440FX-PIIX-1996:4292]:
INFO: Feature map_hugetlb is present in this kernel libhugetlbfs
[p-Standard-PC-i440FX-PIIX-1996:4292]: INFO: Kernel has MAP_PRIVATE
reservations. Disabling heap prefaulting. libhugetlbfs
[p-Standard-PC-i440FX-PIIX-1996:4292]: INFO: Kernel supports MAP_HUGETLB
libhugetlbfs [p-Standard-PC-i440FX-PIIX-1996:4292]: INFO: HUGETLB_SHARE=0,
sharing disabled libhugetlbfs [p-Standard-PC-i440FX-PIIX-1996:4292]: INFO:
HUGETLB_NO_RESERVE=no, reservations enabled libhugetlbfs
[p-Standard-PC-i440FX-PIIX-1996:4292]: INFO: Segment 0 (phdr 0):
0x8000000-0x81042f1 (filesz=0x1042f1) (prot = 0x5) libhugetlbfs
[p-Standard-PC-i440FX-PIIX-1996:4292]: DEBUG: Total memsz = 0x1042f1, memsz
of largest segment = 0x1042f1 libhugetlbfs
[p-Standard-PC-i440FX-PIIX-1996:4292]: INFO: libhugetlbfs version: 2.20
libhugetlbfs [p-Standard-PC-i440FX-PIIX-1996:4293]: INFO: Mapped hugeseg at
0xf7400000. Copying 0x1042f1 bytes and 0 extra bytes from 0x8000000...done
libhugetlbfs [p-Standard-PC-i440FX-PIIX-1996:4292]: INFO: Prepare succeeded
<segfault>

---------------------------------------------------------
Core was generated by `./static.out'. Program terminated with signal
SIGSEGV, Segmentation fault. #0 0x08081c25 in munmap () (gdb) bt #0
0x08081c25 in munmap () #1 0x0804b743 in remap_segments (seg=<optimized
out>, num=<optimized out>) at elflink.c:1122 #2
__lh_hugetlbfs_setup_elflink () at elflink.c:1332 #3 0x08048921 in
setup_libhugetlbfs () at init.c:36 #4 0x080528cd in __libc_csu_init () #5
0x0805240e in __libc_start_main () #6 0x08048b6e in _start ()

$ uname -a Linux p-Standard-PC-i440FX-PIIX-1996 4.3.0+ #12 SMP Tue Mar 8
20:46:38 EST 2016 x86_64 x86_64 x86_64 GNU/Linux

---------------

If any more information is needed please tell.
Please help.

Thanks,
Parag Gupta,
MS Graduate Student,
Department of Computer Science,
Stony Brook University - NY
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to