clinux-kernelelfhuge-pages

usage of hugepages for text and data segments


I am exploring the possibility to back the text and data segment with hugepages following the guide in https://github.com/libhugetlbfs/libhugetlbfs/blob/master/HOWTO.

I have relinked the application as suggested by adding "-B/usr/share/libhugetlbfs -Wl,--hugetlbfs-align" and started the application with "hugectl --text --data --heap --bss /path/to/my/application".

But I am not very sure how to verify whether the data and text segments are indeed copied to the files on the hugetlbfs filesystem.

Checking the /proc/{pid}/maps, it could be seen that the hugepages are used for heap but not for text and data segments as the first two address ranges are mapped to the application but not the hugepage file system.

Is my understanding correct? Actually I suspect my conclusion that hugepages are used for heap from /proc/{pid}/maps is also incorrect.

How should I verify whether the data and text segments are backed in the hugepages? I know that data and text segments will be copied to hugetlbfs filesystem if successful but how to verify it?

Thanks!

output of /proc/{pid}/maps

00400000-00d2c000 r-xp 00000000 fd:02 46153351 /path/to/my/application

00f2b000-00fa3000 rw-p 0092b000 fd:02 46153351 /path/to/my/application

00fa3000-00fbb000 rw-p 00000000 00:00 0

02a0c000-02a2d000 rw-p 00000000 00:00 0  [heap]

40000000-80000000 rw-p 00000000 00:15 2476090 /dev/hugepages-1G/libhugetlbfs.tmp.nS7exn (deleted)

Solution

  • check

       /proc/$pid/numa_maps
    

    contains information about each memory area used by a given process allowing--among other information--the determination of which nodes were used for the pages.

    for formar see http://linux.die.net/man/5/numa_maps