title: JVM large pages support: is memory wasted if large pages is larger than heap?
body: <p>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. </p>
  
  <p>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 (<a href="https://www.ibm.com/support/knowledgecenter/SSAW57_8.0.0/com.ibm.websphere.nd.doc/info/ae/ae/tprf_tunelinux.html" rel="nofollow noreferrer" title="IBM KNC - Tuning Linux systems">IBM Knowledge Center- Tuning Linux systems</a>) switch and for Oracle using -XX:+UseLargePages (<a href="http://www.oracle.com/technetwork/java/javase/tech/largememory-jsp-137182.html" rel="nofollow noreferrer" title="Java Support for Large Memory Pages">Oracle: Java Support for Large Memory Pages</a>)</p>
  
  <p>The current configuration shows </p>
  
  <pre><code>vm.nr_hugepages = 4096 
  Hugepagesize: 2048 kB (from meminfo)
  -Xmx 6144 (for java process)
  </code></pre>
  
  <p>And the JVM starts with -Xlp enabled.</p>
  
  <p>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. </p>
  
  <p>Can anyone please explain what happens to the other 2GB? </p>
  
  <p>Thanks in advance!</p>