I am trying to modify an existing application to use huge pages, which I believe will increase the application's performance due to the large amount of data processed by the application. The application has a single class that serves as the memory allocator and since the application is large, I am trying to find a way to introduce huge page support while only modifying the memory allocator, if possible.
I have done some research on hugetlbfs and it looks like it can be implemented using shmget or mmap. From what I have read, it seems like in order to use mmap, the memory segment must be mapped to a specific filepath location that is reserved for hugepages. Is that correct?

The original memory allocator for my application uses mmap to allocate the memory, but the filepath used to specify the file descriptor argument to mmap() is an argument passed to the constructor for the memory allocator and is a private data member used to identify blocks of memory.

Is there any feasible way that I can use hugepages, while still allowing for the specification of the file descriptor?