Honor AlwaysPreTouch when commiting memory stuefe-new-metaspace-branch
authorstuefe
Tue, 19 Nov 2019 20:01:05 +0100
branchstuefe-new-metaspace-branch
changeset 59138 714474295e0a
parent 59135 84464aa83a29
child 59155 b537e6386306
Honor AlwaysPreTouch when commiting memory
src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp
--- a/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp	Tue Nov 19 16:58:25 2019 +0100
+++ b/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp	Tue Nov 19 20:01:05 2019 +0100
@@ -40,6 +40,7 @@
 #include "memory/metaspace/runningCounters.hpp"
 #include "memory/metaspace/virtualSpaceNode.hpp"
 
+#include "runtime/globals.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/os.hpp"
 
@@ -62,6 +63,7 @@
 }
 #endif
 
+
 // Given an address range, ensure it is committed.
 //
 // The range has to be aligned to granule size.
@@ -108,6 +110,10 @@
     vm_exit_out_of_memory(word_size * BytesPerWord, OOM_MMAP_ERROR, "Failed to commit metaspace.");
   }
 
+  if (AlwaysPreTouch) {
+    os::pretouch_memory(p, p + word_size);
+  }
+
   log_debug(gc, metaspace)("Increased metaspace by " SIZE_FORMAT " bytes.",
                            commit_increase_words * BytesPerWord);