I just found a JVM configuration, where the size of the configured large pages is much bigger than the allocated heap size for the JVM.
The configuration I added below is for a Websphere Application Server, but the problem would be the same for any other Java application that is using large pages. In general large pages are enabled for IBM JRE using -Xlp (IBM Knowledge Center- Tuning Linux systems) switch and for Oracle using -XX:+UseLargePages (Oracle: Java Support for Large Memory Pages)
The current configuration shows
vm.nr_hugepages = 4096
Hugepagesize: 2048 kB (from meminfo)
-Xmx 6144 (for java process)
And the JVM starts with -Xlp enabled.
I would assume that by vm.nr_hugepages 8GB are pinned and thus not available to other processes. But Java would only claim 6GB for Heap.
Can anyone please explain what happens to the other 2GB?
Thanks in advance!
The remaining 2GB of huge pages are pinned in continuous real memory waiting for an application to use them (the JVM config by itself won't grow the heap enough to use the remaining huge pages). That memory is unuseably for anything other then a potential caller.
There is a "transparent huge pages" option in later Linux releases that tries to solve some of these kinds of problems, by moving unwitting applications into any slack space that might exist, but it seems to not get much love.