Enabling use of hugepages with java
Stefan Karlsson
stefan.karlsson at oracle.com
Tue Mar 6 08:30:33 UTC 2018
Hi Richard,
On 2018-02-28 23:04, David Holmes wrote:
> Hi Richard,
>
> Moving to hotspot-dev as the appropriate list.
>
> David
>
> On 1/03/2018 1:20 AM, Richard Achmatowicz wrote:
>> Hi
>>
>> I hope that I am directing this question to the correct mailing list.
>>
>> I have a question concerning the OS setup on Linux required for
>> correct use of the java option -XX:+UseLargePages in JDK 8.
>>
>> Official Oracle documentation
>> (http://www.oracle.com/technetwork/java/javase/tech/largememory-jsp-137182.html)
>> suggests that in order to make use of large memory pages, in addition
>> to setting the flag -XX:+UseLargePages, an OS option shmmax needs to
>> be tuned to be larger than the java heap size.
>>
>> From looking at the java documentation, there are various ways of
>> enabling the use of huge pages: -XX:+UseHugeTLBFS,
>> -XX:+UseTransparentHugePages, -XX:+UseSHM and, if I understand
>> correctly, these correspond in part to making use of different
>> OS-level APIs for accessing huge pages (via shared memory, hugetlbfs,
>> and other means).
>>
>> My question is this: is setting the shmmax OS value only relevant if
>> we are using -XX:+UseSHM? In other words, if we are using
>> -XX:+UseHugeTLBFS to enable use of hugepages by the JVM, is it the
>> case that setting the shmmax OS setting has no effect on the use of
>> hugepages by the JVM?
Yes, your understanding is correct.
The document you link to seems to be from a time before
-XX:+UseHugeTLBFS was added.
This document clarifies this a bit more:
https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html#large_pages
"If you are using the option -XX:+UseSHM (instead of
-XX:+UseHugeTLBFS), then increase the SHMMAX value."
Cheers,
StefanK
>>
>> Thanks in advance
>>
>> Richard
>>
More information about the hotspot-dev
mailing list