My program is using mmap
to allocate memory. Depending on the env running my app, sometimes I want HugePage, or normal memory if there's no HugePage configured.
I want a convenient/universal method to get the page size of the memory returned by mmap
, regardless if I passed MAP_HUGETLB
arg to it.
I tried gethugepagesize()/gethugepagesizes()
, but I can't link it against libhugetlbfs
.
After a lot of searching, I found that linking against this lib is very very complicated, while what I want is merely to know wether or not I'm using a huge page.
It is NOT worth adding many changes into my CMake file.
Furthermore, gethugepagesize()/gethugepagesizes()
is NOT a universal method. If I haven't used MAP_HUGETLB
, I have to call getpagesize()
once again.
Is there a universal method, can get the page size of the memory returned by mmap
?
Thanks!